Back to project page capture-the-flag.
The source code is released under:
Copyright ? 2014 Microsoft Mobile Oy. All rights reserved. Microsoft is a registered trademark of Microsoft Corporation. Nokia and HERE are trademarks and/or registered trademarks of Nokia Corporati...
If you think the Android project capture-the-flag listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (c) 2014 Microsoft Mobile. All rights reserved. * See the license text file provided with this project for more information. *///from w w w .j a v a 2 s . com package com.nokia.example.capturetheflag.notifications.google; import com.google.android.gms.gcm.GoogleCloudMessaging; import com.nokia.example.capturetheflag.notifications.NotificationsUtils; import android.app.IntentService; import android.content.Intent; import android.os.Bundle; /** * Intent service responsible for handling Google Cloud Messaging (GCM) push messages. * <p/> * Receives GCM messages from {@link GcmBroadcastReceiver} and processes them. */ public class GcmIntentService extends IntentService { public static final int NOTIFICATION_ID = 1; /** * Constructor. */ public GcmIntentService() { super("GcmIntentService"); } @Override protected void onHandleIntent(Intent intent) { // Extract GCM message type // Only messages of type GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE are handled. Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty() && (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType))) { NotificationsUtils.broadcastGameMessage(extras.getString("payload"), this); } // Release the wake lock provided by the GcmBroadcastReceiver. GcmBroadcastReceiver.completeWakefulIntent(intent); } }