Jump to content
Sign in to follow this  
Mustafa E. Korkmaz

Java remote service starting from delphi problem for targetSdk 30

Recommended Posts

I wrote android service application in java.
I start this service from my delphi application.

 

I use delphi 11.
Android device OS version 11.


If I set targetsdk to 29 from the manifest file, the project works fine.

 

Cannot start java service from delphi if targetsdk is 30.
I couldn't find how there is a change between api 29 and 30 regarding this issue.

 

    LIntent := TJIntent.Create;
    LIntent.setComponent( TJComponentName.JavaClass.init( StringToJString( PackageNameStr ), StringToJString( ServiceNameStr ) ) );

 

    ServiceConnection := TRemoteServiceConnection.Create;
    ServiceConnection.OnConnected := OnServiceConnected;
    ServiceConnection.OnHandleMessage := OnMessage;
    ServiceConnection.BindService( PackageNameStr, ServiceNameStr );

 

    if ( ( TJBuild_VERSION.JavaClass.SDK_INT >= 26 ) ) then
      startResult := TAndroidHelper.Activity.startForegroundService( LIntent )
    else
      startResult := TAndroidHelper.Activity.startService( LIntent );
 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×