java - Can't bring the user to Notifications settings -


so in app @ moment when user first loads prompt go notification access menu. if select yes redirects it, if no go go onto apps page.

private alertdialog buildnotificationservicealertdialog() {     final alertdialog.builder alertdialogbuilder = new alertdialog.builder(this);     alertdialogbuilder.settitle("one");     alertdialogbuilder.setmessage("two");     alertdialogbuilder.setpositivebutton("yes",             new dialoginterface.onclicklistener() {                 public void onclick(dialoginterface dialog, int id) {                     startactivity(new intent(action_notification_listener_settings));                 }             });     alertdialogbuilder.setnegativebutton("no",             new dialoginterface.onclicklistener() {                 public void onclick(dialoginterface dialog, int id) {                  }             });     return (alertdialogbuilder.create()); } 

when click "yes" closes app , when press "no" should. i've tested on other apps , app appear in notification access menu can't redirect own app.

any 1 have ideas why it's not working?

thanks.

add package name in intent work it.

intent notifintent = new intent(); notifintent.setaction("android.settings.app_notification_settings");  //for android 5-7 notifintent.putextra("app_package", getpackagename()); notifintent.putextra("app_uid", getapplicationinfo().uid);  // android 8 notifintent.putextra("android.provider.extra.app_package", getpackagename());  startactivity(notifintent); 

it work in android 5.0 , above.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -