【问题标题】:how to disable system notifications in android using programming如何使用编程在android中禁用系统通知
【发布时间】:2015-12-27 06:40:45
【问题描述】:

在安卓手机中设置VPN连接时,安卓系统会自动生成带有“钥匙”图标的系统级通知。我正在构建一个需要在内部设置一个 TUN 接口的应用程序,但我担心这个通知会被 android 系统显示在通知栏中。我不希望 android 系统向用户显示此通知。

其次,在设置 VPN 连接时还会弹出警告消息“注意”。同样,此消息也是由 android 系统生成的。

我希望我的应用程序安静地运行,而不会在通知栏中显示任何警告消息和通知。关于如何实现这件事的任何想法??

谢谢

【问题讨论】:

    标签: android android-intent android-activity notifications


    【解决方案1】:

    您无法在不更改 ROM 的情况下删除或禁用它。这是一个安卓功能。

    【讨论】:

      【解决方案2】:

      也许你应该用两个词试试How to cancel Android notificationsHow to properly clear all notification once clicked 之类的东西——像这样:

      // Clear all notification
      NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
      notificationManager.cancelAll();
      } 
      

      【讨论】:

        【解决方案3】:

        您可以使用 Xposed 插件NotifyClean 删除任何通知,甚至是 android 系统通知。

        如果您想从源代码开始,查看他们的源代码可能会有所帮助。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-05-05
          • 1970-01-01
          • 2011-04-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多