Liths Joy
Liths Joy

Reputation: 3

Facebook account kit in Android

How to implement facebook account kit for verifying phonenumbers in Android?Their official documentation seems to be weird.Please help.Also what are the attributes need to be given in styles.xml ?

My LoginActivity

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    FacebookSdk.sdkInitialize(getApplicationContext());

    AppEventsLogger.activateApp(this);
    setContentView(R.layout.activity_login);


}

public void onLoginPhone(final View view) {
    final Intent intent = new Intent(getActivity(), AccountKitActivity.class);
    AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
            new AccountKitConfiguration.AccountKitConfigurationBuilder(
                    LoginType.PHONE,
                    AccountKitActivity.ResponseType.CODE); // or .ResponseType.TOKEN
    // ... perform additional configuration ...
    intent.putExtra(
            AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
            configurationBuilder.build());
    startActivityForResult(intent, APP_REQUEST_CODE);
}





@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_login, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

}

Upvotes: 0

Views: 1691

Answers (1)

Olga Kuznetsova
Olga Kuznetsova

Reputation: 361

You can use this AccountKitSimpleSample as a guide to add the necessary pieces if the docs are harder to read through: https://github.com/fbsamples/account-kit-samples-for-android/tree/master/samples/AccountKitSimpleSample

Are you planning to do any theming? You don't need to update your styles unless you want to customize the UI further than the basic flow.

Upvotes: 2

Related Questions