Redirect to Notification Access Settings

后端 未结 3 1808
名媛妹妹
名媛妹妹 2021-01-03 03:30

I\'m currently developing an app for Android that uses the NotificationListenerService, which requires that the user will enable notification access for my app

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 04:18

    You can open the NotificationAccessSettingsActivity by using the following Intent, but I'm not sure about checking to see if they've already enabled your app.

    startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
    

    Alternatively, for API 22+:

    startActivity(new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS));
    

提交回复
热议问题