Android 解析推送通知有时会停止到达,直到设备断开连接并重新连接到internet
我正在使用Parse-Push-restapi将推送通知从我的Java服务器发送到特定的设备,并通过设备令牌进行过滤。 通常一切都很好。但有时我注意到预期的推送通知尚未到达目的地。 过了一会儿,我开始注意到,如果我断开设备与internet的连接,然后重新连接,所有推送通知都会立即到达 在我看来,这似乎是Android 解析推送通知有时会停止到达,直到设备断开连接并重新连接到internet,android,parse-platform,notifications,push,Android,Parse Platform,Notifications,Push,我正在使用Parse-Push-restapi将推送通知从我的Java服务器发送到特定的设备,并通过设备令牌进行过滤。 通常一切都很好。但有时我注意到预期的推送通知尚未到达目的地。 过了一会儿,我开始注意到,如果我断开设备与internet的连接,然后重新连接,所有推送通知都会立即到达 在我看来,这似乎是ParsePushBroadcastReceiver的某种缺陷,但我只是不确定它可能是什么 这就是我在代码中实际执行的操作: public class MyParsePushBroadcastR
ParsePushBroadcastReceiver
的某种缺陷,但我只是不确定它可能是什么
这就是我在代码中实际执行的操作:
public class MyParsePushBroadcastReceiver extends ParsePushBroadcastReceiver {
@Override
protected void onPushReceive(Context context, Intent intent) {
// Doing what I want
// Calling original onPushReceive
super.onPushReceive(context, intent);
}
}
这是解析安装初始化:
public class MyApp extends Application {
// Initializing Parse for push notifications.
Parse.initialize(this, Constants.APPLICATION_ID, Constants.CLIENT_KEY);
if(getDeviceToken().equals("")) {
ParsePush.subscribeInBackground("MyChannel");
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
Intent i = new Intent(context, GetTokenIntentService.class);
i.setAction(GetTokenIntentService.ACTION_GET_TOKEN);
context.startService(i);
}
});
}
如有必要,我将发布getTokenEntService
的内容
知道为什么会这样吗
提前谢谢 感谢@rici的编辑。如果有人回答我,我也会很感激,因为我真的很迷恋这个。这个仍然复制…任何人请??