Java tutorial
/* * Copyright (c) 2014 Haulmont Technology Ltd. All Rights Reserved. * Haulmont Technology proprietary and confidential. * Use is subject to license terms. */ package com.dolphin.push; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.support.v4.content.WakefulBroadcastReceiver; public abstract class GoogleCloudMessagingBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { ComponentName comp = new ComponentName(context.getPackageName(), serviceName()); startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK); } protected abstract String serviceName(); }