hamed
hamed

Reputation: 119

enable notification access using adb

I have an application that listens to receiving notifications. After installation, I should enable notification access to it from Setting -> Security -> Notification Access

I install this app on an emulator and run it using ADB. But I don't know how to enable notification access setting for it using the command line in ADB.I saw this question and guess its general answer is right but I can not find the actual setting name. Thanks for your consideration.

Upvotes: 7

Views: 14958

Answers (3)

Mayuri Tanksale
Mayuri Tanksale

Reputation: 1

adb shell pm grant com.name.app android.permission.POST_NOTIFICATIONS

Reference

Upvotes: 0

hamed
hamed

Reputation: 119

I found the answer here just type :

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

No spaces after listeners

.....

Upvotes: 4

113408
113408

Reputation: 3444

Since Android 9 the accepted answer is not working anymore. What worked for me was to use :

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

Upvotes: 11

Related Questions