当App不是后台时,XIAOMI MI5通知无法正常工作?

时间:2017-09-03 06:52:41

标签: java android firebase push-notification

当应用程序未在摩托罗拉,三星,索尼上运行时,我的应用程序能够接收推送通知,但如果应用程序未运行,则MI 5的小米无法接收通知。但是WhatsApp通知正常工作。谢谢提前。

小米手机有什么问题吗?

这是我的清单文件

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.VIBRATE" />

和Notification Builder代码

 NotificationManager mNotifyManager =
     (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
 NotificationCompat.Builder mBuilder = new 
 NotificationCompat.Builder(this);
 mBuilder.setPriority(NotificationCompat.PRIORITY_MAX);
 mBuilder.setVibrate(new long[]{1000, 1000});
 mBuilder.setContentText(object.get(ChatConstants.NOTIFICATION.BODY).toString())
 .setContentTitle(object.get(ChatConstants.NOTIFICATION.TITLE).toString())
                                .setContentIntent(pendingIntent)
                                .setSmallIcon(R.drawable.logo_splash)
                                .setAutoCancel(true).setSound(defaultSoundUri);
 mNotifyManager.notify(Request, mBuilder.build());

0 个答案:

没有答案