I need to implement this function :
[JavaSignature('android/app/Activity')]
JActivity = interface(JContextThemeWrapper)
...
procedure onRequestPermissionsResult(requestCode: Integer; permissions: TJavaObjectArray<JString>; grantResults: TJavaArray<Integer>); cdecl;
....
but how to do this ? this function is only to receive event, so i must override it, but i have no idea how to do it.
To implement a callback in the Activity
that underlies your FireMonkey application you have to write some Java code to subclass FireMonkey's own native activity subclass.
This is rather tedious and fraught with issues, and requires various command-line "monkey-business" but I've written the process up for a different callback, onNewIntent
in my Delphi XE7 article on supporting NFC tags (Delphi 10 Seattle made this job feasible without Java activity subclassing). I also wrote the process up for Delphi XE5 for the onActivityResult
callback in the first version of my article on launching Android activities (Delphi XE6 made this job possible without Java activity subclassing).
Be sure to update your Android manifest template file as done with the samples that accompany those articles to refer to the new custom activity subclass, as in:
<activity android:name="com.blong.test.NativeActivitySubclass"
...
Good luck with that. It's rather messy and makes debugging very difficult.