Reputation: 3036
On my device runs a service in an app (its not my app and I cannot uninstall it and my device is not rooted) that is always draining power. I can stop that service in my devices application settings but is there a way to stop it programatically, so I don't have to do that manually all the time ?
Could maybe something like stopService(...); work ?
Is there maybe a way to change the scheduler to prevent the restarts of the service ?
"W/ActivityManager(178): Scheduling restart of crashed service xxxx in 5000ms
Upvotes: 6
Views: 1739
Reputation: 2848
Get the process id of that particular application and then
android.os.Process.killProcess(processIdKillService)
Upvotes: 1
Reputation: 1628
Here is a long shot (I've never tried it):
Context
instance for that app using Context.createPackageContext()
Context.stopService()
Upvotes: 0