Android: stop services and alarms when the application ends -
I have an application that contains many activities when the app starts, then some alarm alarm manager < / Code> and some services are started:
AlarmManager AM = (alarmmanager) context.getSystemService (Context.ALARM_SERVICE); A.setInexactRepeating (...) ....
I would like to know by any means that every service has been shut down and every alarm is unchecked when the user Exits from the application .
The problem is that the user can leave the application from different activities, and I do not like the idea of overriding the onDestroy
method in every activity. Code> intent , when the application ends?
I have also found that an Android application can have a class that spreads from app
to a onTerminate
method:
But the document is very clear: "Depending on this method, it's never being called. In any case, any unnecessary application process will be executed by "Kernel only" without executing any application code.
Any suggestions Highly appreciated.
I guarantee to shut down every service Even if the user exits with the user, then every alarm is unplanned.
There is no such thing as "User Agent of App" in Android. / P>
Can any of the known meanings be found at the end of the application?
not
I have also found that in an Android application there may be a class that extends through the application, with the on-trent method
In some cases, The time will be said later, there are no ongoing components in your case, the ongoing component (services) are there.
But the documentation is very clear: "This method is never assigned; In many cases, an unnecessary application process is performed only by the kernel without executing any application code" only
The only case I know when it will not be called, if the process is ending, then in that case your service will be eliminated, although scheduled alarm will not be there.
Comments
Post a Comment