Getting phone number from Facebook Account Kit

前端 未结 4 1133
暗喜
暗喜 2021-02-06 07:25

The Account Kit documentation states that if your began the login session with AccountKitActivity.ResponseType.TOKEN, it\'s possible to access the Account Kit ID, phone number a

4条回答
  •  渐次进展
    2021-02-06 07:54

    Yes, it's possible provided you use LoginType.PHONE in your configuration.

        AccountKit.getCurrentAccount(new AccountKitCallback() {
            @Override
            public void onSuccess(final Account account) {
                String accountKitId = account.getId();
                PhoneNumber phoneNumber = account.getPhoneNumber();
                String phoneNumberString = phoneNumber.toString();
            }
    
            @Override
            public void onError(final AccountKitError error) {
                // Handle Error
            }
        });
    

    This is your phone number: phoneNumberString; but, account.getEmail() will return null if LoginType.PHONE was used in your configuration.
    Vice versa if you use LoginType.EMAIL in your configuration.

提交回复
热议问题