0

I'm currently developing a plugin for ATAK in which I need to launch a handful of services that have been imported from other modules I've created. When I try to start the services however, I receive the error as stated in the title. I'm a bit confused as the services I've created do include the BIND_JOB_SERVICE permission in both the module itself and plugin AndroidManifests as follows

        <service
        android:name="mqtt.MqttBrokerService"
        android:exported="true"
        android:permission="android.permission.BIND_JOB_SERVICE">
        <intent-filter>
            <action android:name="mqtt.MqttBrokerService"></action>
        </intent-filter>
    </service>

These code blocks are within the application section of the AndroidManifest so that isn't the issue. I'm pretty dumbfounded and not sure why this happening and also why it even requires this permission since it isn't a job service. The cherry on top is I created a sample app that has the exact same Manifest as my plugin and the sample app launches the services just fine. The only difference is in my plugin, I don't launch the services from the main activity as follows

    Intent startMqtt = new Intent("mqtt.MqttBrokerService");
    startMqtt.setPackage("com.atakmap.android");
    getMapView().getContext().startForegroundService(startMqtt);
Johnny Hughes
  • 11
  • 1
  • 2

1 Answers1

0

When you declare a Service with a permission in the manifest, this tells Android that any code that wants to use your Service must hold the specified permission. The error you are getting indicates that some code is trying to use the Service and that code does not hold the permission android.permission.BIND_JOB_SERVICE.

The permission android.permission.BIND_JOB_SERVICE is used by the JobScheduler so I'm thinking that you are trying to use this Service directly and not via the JobScheduler.

David Wasser
  • 93,459
  • 16
  • 209
  • 274