Abgelieferter Test, drücken Sie auf mein Gerät.PUSH-Benachrichtigung dupliziert mit leerem Inhalt
Wenn die Anwendung aktiv ist, kommt Push normalerweise mit Sound, aber wenn die App minimiert ist, kommt 2 leere Pushs und ohne Ton.
Auch wenn onMessageReceived
leer gelassen wird, werden immer noch zwei leere Push-Benachrichtigungen angezeigt.
Die Klasse Empfangs PUSH:
public class MyGcmListenerService extends GcmListenerService implements MyLocation, DownloadListner {
@Override
public void onMessageReceived(String from, Bundle data) {
sendNotificationPushNewMessages();
}
private void sendNotificationPushNewMessages() {
Intent intent = new Intent(this, MainInfoActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
b.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_ALL)
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.mipmap.ic_launcher)
.setTicker("Hearty365")
.setContentTitle("Default notification")
.setContentText("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
.setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_SOUND)
.setContentIntent(contentIntent)
.setContentInfo("Info");
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, b.build());
}
Text PUSH:
{"to":"cHj0nruQddQ:APA91bHZZ4i02rZA7s8qyEIWtBJE-5PUry-mhAUlUWE0z3XVa4kX4CTxwD9cwWLnp-FbAAwc9zBQMf9Hghwz5B7ym51NVSt_S-9ChHW09E2LfHQyT6mtCgjMkF1fNyvQIAKfguH63ze9","content_available":true,"priority":"high","data":{"type":"push_new_messages","text":"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430"}}
content available
und die priority
verwendet für ios Version
Was das Problem sein könnte? Kann die Klasse etwas nicht erhalten, wenn Activiti minimiert wird?