Android Project Configuration

Certain features of the Account Kit SDK are only available when specific Android Permissions are granted to your app. Though not required for Account Kit to work, they will reduce friction during the login process.

These permissions fall into two groups:

Android Permissions for Phone Number and SMS (optional)

If people have Google Play Services installed on their devices, Account Kit can automatically fill in their phone number and the SMS code. Your app can check if Google Play Services is installed with the following code.

private boolean isGooglePlayServicesAvailable() {
    final GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int googlePlayServicesAvailable = apiAvailability.isGooglePlayServicesAvailable(this);
    return googlePlayServicesAvailable == ConnectionResult.SUCCESS;

If Google Play Services isn't installed on the device, your app must ask for the following permissions to enable filling in the phone number and SMS code:

  • READ_PHONE_STATE - auto-read device's phone number
  • RECEIVE_SMS - auto-fill SMS confirmation code

In addition, you must add these permissions to your AndroidManifest.xml.

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />

If you wish to use these permissions in your own app, but do not want Account Kit to use them to pre-fill login information for your people using your app, you may request the permissions in AndroidManifest.xml but turn off their use in Account Kit's configuration manager. For details, see the Perform Additional Configuration in the Account Kit for Android topic.

Additional Email Features (Optional)

The following is a list of additional email features available in the SDK. Although not required for Account Kit to work, they will reduce friction during the login process. We recommend implementing the following:

  • GET_ACCOUNTS - provide drop-down list of device emails
  • intent filter to launch your app from Account Kit email

1. Drop-down list of available emails on device

Certain features of the Account Kit SDK are only available when specific Android Permissions are granted to your app. If people grant the GET_ACCOUNTS permission, the SDK allows them to select the emails available on the device.

Add the following permission to your AndroidManifest.xml to allow the SDK to populate a drop-down of emails:

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

2. Launch your App from Account Kit email

With Account Kit email login, people receive an email sent to their account. When they click on the link in the email on the same device that your app is installed on, this will bring them back to your app to finish the login activity.

Add the following intent filter to your AndroidManifest.xml file:

<activity android:name="com.facebook.accountkit.ui.AccountKitActivity">
    <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      <data android:scheme="@string/ak_login_protocol_scheme" />

And the following in your strings.xml file:

// if your Facebook App ID is 1234567, you should use ak1234567
<string name="ak_login_protocol_scheme">akFACEBOOK_APP_ID</string>

Specifying Supported Languages (Optional)

If you don't need to localize your app into all the languages supported by Account Kit, you can specify only the languages you want in your build.gradle's defaultConfig. This will remove unnecessary localization strings and reduce the size of your app.

defaultConfig {
  // Optional: Specify the language(s) your app supports.
  resConfigs "en", "fr", "pt-rBR"

ProGuard Rules

If you are using ProGuard with certain older versions of the Account Kit SDK for Android, Account Kit may not be able to collect Facebook Analytics for your app. To ensure that your Account Kit conversion analytics remain available, you should include the following ProGuard rules:

-keep class com.facebook.FacebookSdk {
   boolean isInitialized();
-keep class com.facebook.appevents.AppEventsLogger {
   com.facebook.appevents.AppEventsLogger newLogger(android.content.Context);
   void logSdkEvent(java.lang.String, java.lang.Double, android.os.Bundle);