How to relaunch a application immediately in android after being killed?
Hi i make an antivirus and anti theft application on android. I want to relaunc开发者_Python百科h my application immediately after being killed by a task killer. For now, i only use START_STICKY
method from service, but it takes a few time to restart my application and service after being killed. My antivirus and anti theft application should be launch immediately because if the owner's mobile phone was lost, an owner still can monitoring where the last location of their mobile phone. Has anyone know how to restart an application on android immediately which is better than START_STICKY
method? like a Lookout mobile security?
The best thing you could do is use a service activity, this cannot be killed by task killers if I remember this right :)!
A service is made by making a simple extension like this:
public class MyService extends Service {
And you can start this with this:
startService(new Intent(this, MyService.class));
And stop this with
stopService(new Intent(this, MyService.class));
精彩评论