将手机号码传递给 Facebook AccountKitActivity
Pass mobile number to Facebook AccountKitActivity
我正在使用 Facebook account kit 来验证用户手机号码。我使用了下面的代码,
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);
一切都很好。我想将用户手机号码传递给 AccountKit activity。有可能让它发挥作用吗?如何?
其实我想用Account Kit防止重复手机验证,有没有其他方法?
所以在它说的地方
// ... perform additional configuration ...
您可以通过以下方式设置初始 phone 号码:
configurationBuilder.setInitialPhoneNumber(phoneNumber);
其中 phoneNumber 的类型为 com.facebook.accountkit.PhoneNumber。 class 需要 3 个参数:国家代码(如“+1”)、phone 号码(如“5551234567”)和 ISO 国家代码(如 "US")
您还可以在 configurationBuilder 中进行其他设置。参考:https://developers.facebook.com/docs/reference/androidsdk/current/AccountKit/com/facebook/accountkit/ui/accountkitconfiguration.accountkitconfigurationbuilder.html/
你可以用这个
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());
我正在使用 Facebook account kit 来验证用户手机号码。我使用了下面的代码,
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);
一切都很好。我想将用户手机号码传递给 AccountKit activity。有可能让它发挥作用吗?如何? 其实我想用Account Kit防止重复手机验证,有没有其他方法?
所以在它说的地方
// ... perform additional configuration ...
您可以通过以下方式设置初始 phone 号码:
configurationBuilder.setInitialPhoneNumber(phoneNumber);
其中 phoneNumber 的类型为 com.facebook.accountkit.PhoneNumber。 class 需要 3 个参数:国家代码(如“+1”)、phone 号码(如“5551234567”)和 ISO 国家代码(如 "US")
您还可以在 configurationBuilder 中进行其他设置。参考:https://developers.facebook.com/docs/reference/androidsdk/current/AccountKit/com/facebook/accountkit/ui/accountkitconfiguration.accountkitconfigurationbuilder.html/
你可以用这个
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());