使用adb启用通知访问

问题描述 投票:0回答:3

我有一个监听接收通知的应用程序。安装后,我应该从“设置”->“安全”->“通知访问”启用对其的通知访问

我在模拟器上安装此应用程序并使用 ADB 运行它。但我不知道如何使用 ADB 中的命令行为其启用通知访问设置。我看到这个问题并猜测它的一般答案是正确的,但我找不到实际的设置名称。感谢您的考虑。

adb android-notifications
3个回答
11
投票

自 Android 9 起,接受的答案不再有效。对我有用的是使用:

adb shell cmd notification allow_listener com.mypackage.app/com.mypackage.app.mylistener

4
投票

我找到了答案在这里 只需输入:

adb shell settings put secure enabled_notification_listeners %nlisteners:com.example.myapplication/com.example.myapplication.service.ServiceNotificationIntercept

听众后面没有空格

......


0
投票
adb shell pm grant com.name.app android.permission.POST_NOTIFICATIONS

参考

© www.soinside.com 2019 - 2024. All rights reserved.