GetAccounts for Android (target 26) using Delphi 10.3 [on hold]

  

I’m using Delphi 10.3 for developing android application. I need to get the available account details in the mobile. I have provided the permission for GetAccounts and how can I get the available account details?

Previously I have tried out the following code:

function GetAccountEmails: TStringList;
var
jAm: JAccountManager;
accounts: TJavaObjectArray<JAccount>;
jAcc: JAccount;
begin
Result := TStringList.Create;
jAM := TJAccountManager.JavaClass.get(SharedActivityContext);
if jAM <> nil then begin
accounts := TJavaObjectArray<JAccount>.Wrap(jAM.getAccountsByType(StringToJString(‘com.google’)));
if accounts <> nil then
begin
//CommonFuncsProcs.DisplayThreadedMessage(IntToStr(accounts.Length));
//mmLog.Lines.Add(‘Length Accounts: ‘ + IntToStr(accounts.Length));
//SetLength(Result, accounts.Length);
if accounts.Length > 0 then
begin
jAcc := accounts.Items[0];
//mmLog.Lines.Add(JStringtoString(jAcc._Getname));
Result.Add( JStringtoString(jAcc._Getname) );
end
else
begin
//mmLog.Lines.Add(‘no accounts available’);
end;
end;
end
else
begin
//mmLog.Lines.Add(‘no accounts found’);
end;
end;

But this code does not work for the Android targeting 26.
Is there any code to implement Delphi 10.3 for targeting Android 26?

Comments are closed.