Last active
January 20, 2016 04:14
-
-
Save a1yama/2e645e31b9803c66f962 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.IntentService; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.util.Log; | |
import com.google.android.gms.gcm.GoogleCloudMessaging; | |
public class GcmIntentService extends IntentService { | |
private final String PUSH_MSG_KEY = "message"; | |
private final String PUSH_TITLE_KEY = "title"; | |
private final int NOTIFICATION_ID = 1; | |
public GcmIntentService() { | |
super("GcmIntentService"); | |
} | |
@Override | |
protected void onHandleIntent(Intent intent) { | |
try { | |
Bundle extras = intent.getExtras(); | |
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); | |
String messageType = gcm.getMessageType(intent); | |
// TODO notify | |
} | |
} | |
} finally { | |
// 必ず実行する | |
GcmBroadcastReceiver.completeWakefulIntent(intent); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment