'Prevent an app from restarting when force stopped
I noticed that TikTok is able to restart itself if you force stop it. It doesn't restart right away but it will eventually. I find this actually disgusting and that Android even allows this. It has been widely reported that TikTok is extremely invasive and will collect a lot of information from your device. That's bad enough, but forcing the app to restart when it is not used to just keep on collecting data is even worse.
According to the documentation, AlarmManager allows for this behavior. What I have not been able to find is a way to prevent this from happening. Is there a way to kill an app and keep it killed until it is manually started?
Solution 1:[1]
You could either try to manually kill the background service of TikTok, which can be found under:
Settings -> System -> Developer Options -> Running Services -> Find anything labeled TikTok or musically and stop that.
Other way would be to try to use Androids battery optimization feature:
Apps & notifications -> Advanced -> Special app access -> Battery optimization
Tap on the ‘Not optimized’ option if not selected by default. Select an app (in your case TikTok) you want to enable Battery Optimization on and tap on Optimize.
This should hopefully prevent the app from restarting automatically. Other ways would include rooting your device.
Solution 2:[2]
Yes, it's possible to prevent the app from restarting. Simply, there is a default error handler in android for force stop and you should override it to prevent the app from restarting and show your custom error page. It could be an error page, app close, or anything else . you can use the UCE-Handler library.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Noltibus |
| Solution 2 | behrad |
