Skip to content

Instantly share code, notes, and snippets.

@renanreismartins
Created October 22, 2013 21:29
Show Gist options
  • Save renanreismartins/7108497 to your computer and use it in GitHub Desktop.
Save renanreismartins/7108497 to your computer and use it in GitHub Desktop.
public class GcmIntentService extends IntentService {
@Override
protected void onHandleIntent(Intent intent) {
Bundle extras = intent.getExtras();
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
String messageType = gcm.getMessageType(intent);
if (!extras.isEmpty() && GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
sendNotification(extras.getString("descricao"), extras.getString("endereco"));
}
GcmBroadcastReceiver.completeWakefulIntent(intent);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment