How to send broadcast when Android service goes down? -


i issue broadcast when service goes down. callback guaranteed run when happens? want other apps know down, cannot take chance goes down , no 1 knows it. @ point in service lifecycle (which method) should issue sendbroadcast(imgoingdown)? example, how ondestroy() called?

while answers here aiding in ondestroy approach, there many events on service being destroyed cannot intervene. instance, if user has force closed application, service destroyed, ondestroy not executed.

on common scenario, service destroyed when has ran out of operations (mostly know finished), when no other process bound service, or when stopself()is executed, , common, when device running low on ram.

ondestroy scenario can restart it.

as suggestion, if device has killed process due low ram, dont restart right away. set handler or alarmmanager start bit later (so lack of memmomry dont execute in again.)


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -