Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass mobile number to Facebook AccountKitActivity

I am using Facebook account kit to verify user mobile number. I have used below code,

final Intent intent = new Intent(MainActivity.this, AccountKitActivity.class);
    AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
            new AccountKitConfiguration.AccountKitConfigurationBuilder(
                    LoginType.PHONE,
                    AccountKitActivity.ResponseType.TOKEN); // or .ResponseType.TOKEN
    // ... perform additional configuration ...
    intent.putExtra(
            AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
            configurationBuilder.build());
    startActivityForResult(intent, APP_REQUEST_CODE);

All is doing well. I want to pass user mobile number to AccountKit activity. Is it possible to make it work? How? Actually I want to prevent duplicate mobile verification using Account Kit, is there any other way?

like image 717
Exigente05 Avatar asked Dec 14 '22 20:12

Exigente05


1 Answers

You can use this

PhoneNumber phoneNumber = new PhoneNumber("+880","16XXXXXXXX","BD"); // country code, phone number, country code 

 final Intent intent = new Intent(context, AccountKitActivity.class);
    AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder = new AccountKitConfiguration.AccountKitConfigurationBuilder(
                    LoginType.PHONE,
                    AccountKitActivity.ResponseType.CODE);

    configurationBuilder.setReadPhoneStateEnabled(true)
            .setReceiveSMS(true);

    intent.putExtra(
            AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
            configurationBuilder
                    .setInitialPhoneNumber(phoneNumber)
                    .build());
like image 200
Nazmus Saadat Avatar answered Dec 27 '22 07:12

Nazmus Saadat