Does anyone know how to get service ObjectID (JNI Object) or JService from TAndroidService in Delphi?
Thank you very much for your advice and answers.
Does anyone know how to get service ObjectID (JNI Object) or JService from TAndroidService in Delphi?
Thank you very much for your advice and answers.
TAndroidService
inherits from TAndroidBaseService
, which has a property called JavaService
of type JService
. So something like:
uses
Androidapi.JNI.App;
...
var
ServiceIntf: JService;
...
ServiceIntf := MyService.JavaService;
If you want the JNI object, try casting JavaService
as ILocalObject
and calling the GetObjectID
method:
uses
Androidapi.Jni;
...
var
ServiceObjectID: JNIObject;
...
ServiceObjectID := (ServiceIntf as ILocalObject).GetObjectID; // gets the JNI ObjectID