I am looking to create a system service while using system permissions. The service should be bounded to an activity and fits the following requirements
- Service will not be killed by the system.
- When requested, service can be stopped.
In order to achieve the first requirement I have created my service by using Context.bindService() creating a binded system service and added android:persistent="true" to the service manifest informing the system that this service should remain running at all time.
Unfortunately after adding android:persistent="true" I'm unable to stop the service neither by Context.unbindService() or by calling Context.stopService()
Is it possible to stop a service with android:persistent="true" and if not what should be my approach in order to achieve both of the requirements