Hello,
I'm trying to get user email registered account without the GET_ACCOUNTS permission (android.permission.GET_ACCOUNTS).
Is anyone can help to translate into B4A (?) :
Source : https://developers.google.com/android/reference/com/google/android/gms/common/AccountPicker
Thanks,
Thierry
I'm trying to get user email registered account without the GET_ACCOUNTS permission (android.permission.GET_ACCOUNTS).
Is anyone can help to translate into B4A (?) :
B4X:
public void pickUserAccount() {
/*This will list all available accounts on device without any filtering*/
Intent intent = AccountPicker.newChooseAccountIntent(null, null, null, false, null, null, null, null);
startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
/*After manually selecting every app related account, I got its Account type using the code below*/
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_PICK_ACCOUNT) {
// Receiving a result from the AccountPicker
if (resultCode == RESULT_OK) {
System.out.println(data.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE));
System.out.println(data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME));
} else if (resultCode == RESULT_CANCELED) {
Toast.makeText(this, R.string.pick_account, Toast.LENGTH_LONG).show();
}
}
}
Source : https://developers.google.com/android/reference/com/google/android/gms/common/AccountPicker
Thanks,
Thierry