Android: BroadcastReceiver Time limit -


are there time limits defined actions run inside broadcastreceiver.onreceive method?

onreceive() called on main application thread, same thread drives ui. in general, want onreceive() return in under millisecond, in case ui in foreground, not freeze ui (a.k.a., have "jank"). there 5-10 second limit, after android crash app.

however, cannot reliably fork background thread onreceive(), once onreceive() returns, process might terminated, if not in foreground.

for manifest-registered receiver, typical pattern have onreceive() delegate work intentservice, has own background thread and, being service, tells os process still doing work , should let process run bit longer.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -