android - Keeping a receiver alive after the service get killed -
i'll start telling story first ..
i have service mservice, receiver mreceiver, preferencefragment switch .
now, switch run service, register screen.off receiver, when screen off, receiver called, , check if screen locked, if yes output log message .
so, locking means killing service, receiver called twice , go off, i've registered receiver , unrigstered in ondestory in mservice .
i've added boolean, , thought adding "if" statement in ondestroy, if it's on , getting killed, run service when device unlocked .
another thought, it's making service alive ( drain battery ) .
what want, keep listen screen.off, , don't want start use 1 of them without advice using, or maybe understood in wrong way ? .
codes basic one, register / unregister / class extends service.
if need keep receiver working - need hosts receiver. yes, need keep service alive.
Comments
Post a Comment