I'm writing a FMX app (lets call it appD) for Android in Delphi 11.3 that has to be called/started - and receive some data - from an Android app (let's call it appF) developed by another team (they use Flutter).
AppF uses an intent like this for calling my app:
AndroidIntent(
action: "android.intent.action.launch.from.appF",
package: "com.test.appd",
arguments: {
"userId": "User01”,
"token": "SomeToken"
},
flags: [0123456],
)
My app, appD, starts when called by tappF, but I'm unable to receive the data I need (userID, token and flags).
I have made some experiments with the following code from the sample project ReceiveIntent.dproj, but without success:
function TForm1.HandleIntentAction(const Data: JIntent): Boolean;
var
Extras: JBundle;
jsonMsg: string;
begin
Result := False;
if Data <> nil then
begin
Memo1.ClearContent;
Extras := Data.getExtras;
if Extras <> nil then begin
jsonMsg := JStringToString(Extras.getString(TJIntent.JavaClass.EXTRA_TEXT));
Memo1.Text := jsonMsg;
end;
Invalidate;
end;
end;
This function is called and I get no errors, but jsonMsg is always empty.
I'm a noob as per Android development... can someone show me the right way to retrieve the arguments passed by the appF? I'm really lost...
Thanks for your time!