Then start GenyMotion and add an emulator with the preset !! PREVIEW - Google Nexus 5X - 6.0.0 - API 23 - 1080x1920. Start it and wait until you see the homescreen.

The next step is to flash the Genymotion-ARM-Translation_v1.1.zip. To do that, just drap & drop the .zip file onto the emulator.

Turn the emulator off with the power button and wait until it is powered off. Then turn it on again.

Now repeat the last two steps with gapps-L-4-21-15.zip (flash, reboot).

If you are finished with that, sign into your Google account (you can do that when opening the Play Store). If you are successfully logged in, flash the benzo-gapps-M-20151011-signed-chroma-r3.zip file and reboot again.

jueves, 30 de junio de 2016

Create Android Project

Make sure you have an up to date version of Android Studio. I am using version 1.4.1

Open Android Studio and create a New Project, naming it as you wish. Click Next, choose Minimum API level 17 and click Next again. Choose Blank Activity as the first activity, name it LoginActivity and click Finish.

Add Internet permissions to AndroidManifest.xml:

<uses-permissionandroid:name="android.permission.INTERNET"/>

Next we add another blank activity to the project. Right Click the package and select New -> Activity -> Blank Activity. Leave its name as default and click finish.

The final project for this article can be found on Github. Make sure you change the Facebook API details to match you own.

Creating Facebook App ID

To use the Facebook API we have to add an app entry to our Facebook Developer Apps dashboard. You will need a Facebook developer account if you don’t have one already. Choose a random category and click Create App ID.

On the next page, scroll down to the bottom and complete both fields with the project packages names.

Click Next.

Now we need to add a Development Key Hash. There are two ways of generating one. The first option is using the command line.

Next we need to show the famous Facebook Log in button. We don’t need to make it from scratch as it exists inside the SDK’s libraries and can be called in our layout.

So we will edit our LoginActivity’s layout. It’s name should be content_login.xml. In fact, the latest version of Android Studio creates two default .xml files for every activity we create. The other layout file is called activity_login.xml.

In activity_login.xml delete the code for the floating button as we wont need it.

In content_login.xml there is only a TextView element. We will remove it and create a new LinearLayout that is horizontally oriented. Inside that layout we will add the log in button. Paste the code below to replace the current contents of content_login.xml:

The nextActivity() function in the LoginActivity class passed some strings to our next activity. Now we use them by creating three other strings inside the onCreate() method of the MainActivity class and storing the passed data in them: