0

您好,我正在爲使用GCM的多個移動設備實施推送通知。當我一次嘗試運行2個仿真器並通過JSP頁面發送消息時,它的工作正常。在我的移動設備上安裝我的apk文件後,我得到註冊ID,但如果我試圖通過JSP發送消息到該特定設備,我收到錯誤,如無效註冊。我在谷歌搜索,但仍然沒有得到妥善解決我的問題通過GCM向移動設備發送消息時註冊無效

我正在使用sender.send(message, regIdList, 1);此語句在Servlet發送消息從JSP頁到android設備。

Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 
    NotificationCompat.Builder noBuilder = new NotificationCompat.Builder(this) 
      .setSmallIcon(R.mipmap.ic_launcher) 
      .setContentText("My GCM message :X:X") 
      .setContentText(message) 
      .setAutoCancel(true) 
      .setContentIntent(pendingIntent); 
    NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); 
    notificationManager.notify(0,noBuilder.build()); 

請建議我的問題

回答

0

是什麼在regIdList一些解決方案? 來自GCM的無效註冊意味着它們沒有服務器發送的令牌ID。如果你正在解析它們的文件,也許嘗試在白色空間修剪()?

相關問題