When I extend GcmListenerService
, is onMessageReceived
running in a background process or is it on the UI thread? I need to know if I may make network calls inside the method body without using an asyncTask or such.
I looked at the source code and sure enough it is a vanilla service with no handlers. But there is a bit of code about THREAD_POOL_EXECUTOR and a number of apparently obfuscated stuff.
When I extend
GcmListenerService
, isonMessageReceived
running in a background process or is it on the UI thread? I need to know if I may make network calls inside the method body without using an asyncTask or such.
Yes you can make network calls inside onMessageReceived()
method because it is running in a background process. For example, you can download an image in this method before displaying it on notification using big image notification style.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With