I have two applications I am building targeting Android 7.1 (running in emulator for this). App1 and App2
One of the apps contains a JobIntentService, which I have implemented overrides for onCreate
and onhandleWork
This service is declared in App2's android manifest (com.example.app2) with
<service android:name:"MyJobIntentService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" ></service
>
From an activity in App1, I am attempting to launch the service with an intent:
Intent myServiceIntent = new Intent();
myServiceIntent.setComponent(new ComponentName("com.example.app2", "com.example.app2.MyJobIntentService"));
startService(myServiceIntent);
the problem is I get an exception
java.lang.SecurityException: Not allowed to start service Intent { cmp=com.example.app2/.MyJobIntentservice } without permission android.permission.BIND_JOB_SERVICE
Is this a bug? I am able to, for example remove the service definition from the manifest, and it will complain it can't find the service. I can also change export to false, and it will complain about that. It just doesn't seem to recognize the BIND_JOB_SERVICE permission.