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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -