通知会立即取消


ikun
2025-03-11 04:12:24 (10天前)
  1. 我需要创造


通知
</跨度>
在我的应用程序中我正在构建它像这样:

protected void onCreate(Bundle savedInstanceState){
[…]
mBuilder = new NotificationCompat.Builder(this锟)
.setSmallIcon(R.drawable.logo_ico)
.setContentTitle(“我的

通知
</跨度>
“)
.setContentText(“Hello World!”);

  1. Intent resultIntent = new Intent(这是MainActivity.class

2 条回复
  1. 0# Just do it | 2019-08-31 10-32



    尝试在mBuilder上设置标志:




    1. mBuilder.setFlags(Notification.FLAG_NO_CLEAR);

    2. </code>


    是的,可以有多个通知。要显示第二个通知,请使用其他ID。例如

    notificationManager.notify(2, mBuilder.build());


    http://developer.android.com/reference/android/app/Notification.html#FLAG_NO_CLEAR


登录 后才能参与评论