英文:
Received blank notification periodically in Android
问题
我在我的应用程序中遇到了一个非常奇怪的问题,涉及到推送通知。
在过去的几周里,我收到了我的应用程序上的空白通知。我能够正确接收与订单、活动、促销消息相关的推送通知。
当我试图在logcat中找到与此相关的内容时,我得到了以下日志。尝试通过搜索来找到一些解决方案,但没有找到任何明确的原因。
有人对此有任何想法吗?
Logcat:
2023-06-16 15:28:24.185 2606-2606 NotificationService pid-2606 E 正在静音最近嘈杂的通知 0|0|FCM-Notification:253925648|11704
2023-06-16 15:28:24.228 2606-2606 NotificationService pid-2606 E 正在静音最近嘈杂的通知 0|0|FCM-Notification:253925696|11704
2023-06-16 15:28:24.291 2606-2606 NotificationService pid-2606 E 正在静音最近嘈杂的通知 0|0|FCM-Notification:253925746|11704
2023-06-16 15:28:24.322 2606-2606 NotificationService pid-2606 E 正在静音最近嘈杂的通知 0|0|FCM-Notification:253925788|11704
英文:
I have encountered with a very strange issue in my App with Push Notification.
From last couple of weeks, i am getting the blank notification on my App. I am able to received push notification correctly related to order, campaign, promotional message from the application.
when i tried to found related to this in logcat, i got below logs. Tried to get the some solution using googling, but did not found any concrete reason for this.
Anyone have any ideas on this ?
Logcat ::
2023-06-16 15:28:24.185 2606-2606 NotificationService pid-2606 E Muting recently noisy 0|0|FCM-Notification:253925648|11704
2023-06-16 15:28:24.228 2606-2606 NotificationService pid-2606 E Muting recently noisy 0|0|FCM-Notification:253925696|11704
2023-06-16 15:28:24.291 2606-2606 NotificationService pid-2606 E Muting recently noisy 0|0|FCM-Notification:253925746|11704
2023-06-16 15:28:24.322 2606-2606 NotificationService pid-2606 E Muting recently noisy 0|0|FCM-Notification:253925788|11704
答案1
得分: 1
Android系统正在从您的应用程序中“静音通知”,因为它已被分类为“最近有噪音”。您的应用程序在短时间内发送了大量通知,使用诸如“通知通道”和“重要性级别”的功能,为用户提供更多控制他们从您的应用程序接收的通知类型,以确保您不会在短时间内发送过多的通知。
从应用程序设计方面,以下一项或多项可能与您相关:
-
应用程序代码和逻辑:
查找触发通知的逻辑或确定何时发送通知的数据的更改。 -
检查“外部数据源”的更改,触发通知
-
检查用户如何与您的应用程序交互,以查看用户行为是否发生了任何变化
-
向您的应用程序代码添加“调试语句”以记录有关通知的信息:
// 创建通知
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle("My notification")
.setContentText("Hello World!")
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
// 添加一个调试语句以记录有关通知的信息
Log.d("MyApp", "发送通知:" + builder.toString());
// 发送通知
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(notificationId, builder.build());
创建一个“NotificationCompat.Builder对象”来构建一个“通知”,然后使用“Log.d”方法记录有关通知的信息。“Log.d方法”使用“DEBUG日志级别”将消息写入“logcat”。您可以使用不同的日志级别(例如“VERBOSE,INFO,WARN,ERROR”)来控制调试语句的冗长程度。
英文:
Android system is muting notifications
from your app because it has been classified as “recently noisy" . Your app has sent a large number of notifications in a short period of time,
use features such as notification channels
and importance levels
to give users more control over the types of notifications they receive from your app to ensure that you are not sending too many notifications in a short period of time
From the app design end one or more of these maybe relevant to you :
-
App code and logic :
Look for changes to the logic that triggers notifications or changes to the data that is used to determine when notifications should be sent. -
Check for changes to
external data sources
that triagger notification -
check how users are interacting with your app to see if there have been any changes in user behavior
-
add
debugging statements
to your app’s code to log information about notifications:// Create a notification NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID) .setSmallIcon(R.drawable.notification_icon) .setContentTitle("My notification") .setContentText("Hello World!") .setPriority(NotificationCompat.PRIORITY_DEFAULT); // Add a debugging statement to log information about the notification Log.d("MyApp", "Sending notification: " + builder.toString()); // Send the notification NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); notificationManager.notify(notificationId, builder.build());
create a NotificationCompat.Builder object
to build a notification
and then use the Log.d
method to log information about the notification. The Log.d method
writes a message to the logcat
with the DEBUG log level
. You can use different log levels (e.g., VERBOSE, INFO, WARN, ERROR
) to control the verbosity of your debugging statements.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论