android - Does a GCM-App really need a wakelock? -


i'm not quite sure how interpret sentences in gcm client documentation:

the android.permission.wake_lock permission application can keep processor sleeping when message received. optional—use if app wants keep device sleeping.

.

if don't hold wake lock while transitioning work service, allowing device go sleep before work completes. net result app might not finish processing gcm message until arbitrary point in future, not want.

and

using wakefulbroadcastreceiver not requirement. if have relatively simple app doesn't require service, can intercept gcm message in regular broadcastreceiver , processing there.

i'm not quite sure if app needs hold wakelock or not (or if requires service). push notification part quite important app , should not delayed more few minutes. there chance broadcastreceiver gets suspended before receiving data?

is there chance broadcastreceiver gets suspended before receiving data?

no. not control until entire 4k-or-less payload has been downloaded , available you.

however, onreceive() called on main application thread, , if work take more millisecond or so, should use wakefulbroadcastreceiver , intentservice work. or, if prefer, use my wakefulintentservice , regular broadcastreceiver.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -