4Manuals

  • PDF Cloud HOME

将新通知添加到组时,Android删除组通知中的通知数据 Download

    如何在Android中使用WebRTC缩放相机 Android 10,API29:在应用程序文件夹中使用C ++库编写文件会使应用程序崩溃 如何将动态值传递给渐变xml 加载数据并推送到未显示的RecyclerView中 调用Model类的函数时出现java.lang.NullPointerException 从网络加载图像时,“接收到完整的报头之前关闭连接 Ionic 3错误:“缺少文件google-services.json。没有它,Google Services插件将无法运行。”在离子科尔多瓦建立/准备Android androidx.appcompat.view.menu.MenuItemImpl无法转换为android.widget.TextView 从Firebase发送推送通知不起作用 Ljava / applet / Applet上的Android LDAP / NoClassDefFoundError;

我的群组通知运行正常,但是,我注意到在几个小时后(当一段时间不使用设备时)收到新通知时,扩展通知时消息内容消失了。我知道这不是请求代码问题,因为所有请求代码都是唯一的,并且我能够像往常一样回复通知。

要注意的一件事是,通知contentText消失之后,出现的下一个通知(如果设备处于活动状态(不一定是应用程序)),则该通知在展开时将显示其正常文本。这似乎仅在一段时间不使用设备AND / OR应用程序时才会发生。这是一个android系统问题吗?

下面是描述行为的图片快照:


第一个通知

first notification


第二条通知进来了。

second notification comes in


扩展两个通知,因为您会看到它们的所有消息都消失了。

expanding both notifications


代码:请注意,我只发送一次摘要通知。

// Normal notification
int uniqueRequestCode = RandomUser.getUniqueRequestCode();
PendingIntent pendingIntent = PendingIntent.getActivity(
        this, uniqueRequestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Notificatio notification = new NotificationCompat.Builder(getApplicationContext(), MESSAGE_CHANNEL_ID)
    .setSmallIcon(R.drawable.ne1_white_logo_crop)
    .setContentTitle(title)
    .setContentText(body)
    .setStyle(new NotificationCompat.BigTextStyle().bigText(body))
    .setPriority(NotificationCompat.PRIORITY_DEFAULT)
    // Set the intent that will fire when the user taps the notification
    .setContentIntent(pendingIntent)
    .addAction(action)
    .setGroup(GROUP_KEY_MESSAGE)
    //.setGroupAlertBehavior(groupAlert)
    .setColor(Color.BLACK)
    .setAutoCancel(true)
    .build();

// Summary notification 
uniqueRequestCode = RandomUser.getUniqueRequestCode();  
PendingIntent pendingIntent = PendingIntent.getActivity(
    this, uniqueRequestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification summaryNotification = new NotificationCompat.Builder(this, MESSAGE_CHANNEL_ID)
        .setSmallIcon(R.drawable.ne1_white_logo_crop)
        // Specify which group this notification belongs to
        .setGroup(GROUP_KEY_MESSAGE)
        // Set this notification as the summary for the group
        .setGroupSummary(true)
        .setContentIntent(pendingIntent)
        .build();

0 个答案:

没有答案



Similar searches
    Blazor在Chrome中不起作用,但在Edge中可用 启动Local Dev Server:是否可以打开计算机到Internet? Samsung RS2666SL Refrigerator User Manual 如何在单击按钮时切换SVG图标-使用QT C ++ Samsung RS2555SW Refrigerator User Manual