Search code examples
androidbroadcastreceiver

Broadcast receiver goAsync


An android receiver has a short lifetime, no more than 10 seconds. Is the goAsync() method a way to "bypass" this limit? If no, what is the real goal of goAsync()?


Solution

  • It changes the thread so you can do computationally heavy work without freezing the UI thread. Read the docs:

    " This does not change the expectation of being relatively responsive to the broadcast (finishing it within 10s), but does allow the implementation to move work related to it over to another thread to avoid glitching the main UI thread due to disk IO."