Android: Service stops and restarts after Activity crash -
i have activity
launches service
startservice
, binds
service communication between two. in onstart
of service return start_sticky
because want service keep running no matter what. service contains logic , activity responsible ui.
the problem is: if close app (swiping away recent apps) service keeps running without problem. if activity crashes (for unhandled exception) service stops working without calling ondestroy
, restarts oncreate
, onstart
.
how can keep service running if app crashes?
edit: if system reaches low memory app force-closed , service stops , restarts. problem not on crashes therefor solution can't put codes in try-catch blocks.
thanks
you should use remote service in different process adding
android:process=":whatever"
and binding serviceconnection.
Comments
Post a Comment