As you know, recently Google changed their GCM documentation, and they claim that an IntentService
is no longer required for handling arriving GCM messages. All the handling can be done in the BroadcastReceiver
.
When trying to figure out if there is any good reason to continue using the IntentService
, I came across this quote:
A Service (typically an IntentService) to which the WakefulBroadcastReceiver passes off the work of handling the GCM message, while ensuring that the device does not go back to sleep in the process. Including an IntentService is optional—you could choose to process your messages in a regular BroadcastReceiver instead, but realistically, most apps will use a IntentService.
Why would most apps use an IntentService
? Are there any scenarios in which handling the GCM message directly in the BroadcastReceiver
won't work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…