Click Action не работает для моего устройства Xiamoi (Nougat), но оно отлично работает с Samsung (Lollipop)
Код службы передачи сообщений Firebase показан ниже
public class FirebaseMessagingService extends
com.google.firebase.messaging.FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
String notification_title = remoteMessage.getNotification().getTitle();
String notification_message = remoteMessage.getNotification().getBody();
long[] v = {500,1000};
NotificationCompat.Builder mBuilder ;
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
mBuilder = new NotificationCompat.Builder(this, "notify")
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(notification_title)
.setContentText(notification_message)
.setSound(uri);
mBuilder.setVibrate(v);
Intent resultIntent = new Intent("MAINACTIVITY");
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
this,
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
int mNotificationId = (int) System.currentTimeMillis();
NotificationManager mNotifyMgr =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNotifyMgr.notify(mNotificationId, mBuilder.build());
}
}
Я тестировал на Samsungон работает нормально, но действие нажатия не отвечает за Xiamoi.Я не знаю, где ошибка.