Skip to content

Instantly share code, notes, and snippets.

@a1yama
Created January 20, 2016 04:09
Show Gist options
  • Save a1yama/a2607e66a2d391a6abc1 to your computer and use it in GitHub Desktop.
Save a1yama/a2607e66a2d391a6abc1 to your computer and use it in GitHub Desktop.
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Serviceの起動
ComponentName comp =
new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment