相关疑难解决方法(0)

Firebase 通知没有以高优先级发送

当我通过 Firebase 网络界面向我的 Android 设备发送通知时,通知不会从状态栏向下窥视。如果我想看到通知,我必须向下滑动。即使我High在 Web 界面中将优先级设置为,也会发生这种情况。为什么是这样?

如果在应用程序打开时收到通知,这不是问题,因为我可以在我的FirebaseMessagingService班级中自己设置优先级:

public class MyFirebaseMessagingService extends FirebaseMessagingService {

  @Override public void onMessageReceived(RemoteMessage remoteMessage) {
    super.onMessageReceived(remoteMessage);
    sendNotification("Message Body");

  }

  /**
   * Create and show a simple notification containing the received FCM message.
   *
   * @param messageBody FCM message body received.
   */
  private void sendNotification(String messageBody) {
    Intent intent = new Intent(this, SubscribedActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
        PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-notifications

5
推荐指数
1
解决办法
8125
查看次数

标签 统计

android ×1

firebase ×1

firebase-notifications ×1