简体   繁体   中英

GCM Android Push Notification: send OK but not delivered

I'm trying to send push notification to android devices. I have not problem to register the ID of the emulator or the devices, but it's impossibile to receive messages also if the send status is 200 OK . I also try to look to firewall settings, but it's already turned off.
I tried also to use PushBots service from web: same thing. Device registered correctly, message sent, but not delivered to emulator or devices.

在此处输入图片说明

It was my mistake. I didn't notice the app was giving me exception when sending push from web for an error in the manifest Receiver. Implemented the NotificationManager now I receive the push messagge into device.

 public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {


 @Override
      public void onReceive(Context context, Intent intent) {

    // Explicitly specify that GcmMessageHandler will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(),
            GcmMessageHandler.class.getName());

    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
} 


 }


 @Override
        protected void onHandleIntent(Intent intent) {

              Bundle extras = intent.getExtras();

    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);

    String messageType = gcm.getMessageType(intent);

   mes = extras.getString("title");

   sendNotification(mes);
   sendAlert(mes);
   Log.i("GCM", "Received : (" +messageType+")  "+extras.getString("title"));

    GcmBroadcastReceiver.completeWakefulIntent(intent);

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM