I have implemented GCM in android app. I cannot understand why I get push notification sometimes and sometimes I don't get.
GcmBroadcastReceiver
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
ComponentName comp = new ComponentName(context.getPackageName(),
GCMNotificationIntentService.class.getName());
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}
GCMNotificationIntentService
public class GCMNotificationIntentService extends IntentService {
public GCMNotificationIntentService() {
super("GCMNotificationIntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
Bundle extras = intent.getExtras();
String Request_Type,Msg="",Time="",Date="",Firmid = "";
String message = intent.getExtras().getString("price");
}
}
Is there anything else I can do to ensure that the push notification is delivered everytime ?