如何从PreferenceScreen启动我的Android应用程序的设备通知设置

时间:2018-12-07 05:54:46

标签: android preferencescreen

我想从PreferenceScreen启动我的Android应用程序(奥利奥版)的手机通知设置。 我在preferences.xml文件中使用以下内容。但是,它不起作用。有人有主意吗?

  mydata = [{"one":"1","two":"2"},
            {"one":"3","two":"4"}]


Grafana expected json format structure for converting json to table format:
  [
 {
   "columns":[
   {"text":"Time","type":"time"},
  {"text":"Country","type":"string"},
  {"text":"Number","type":"number"}
],
"rows":[
  [1234567,"SE",123],
  [1234567,"DE",231],
  [1234567,"US",321]
],
"type":"table"
 }
]

1 个答案:

答案 0 :(得分:1)

对于Android 5-7:     您必须通过代码(以编程方式)调用启动活动,因为无法确定布局文件中应用程序的uid

Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", getPackageName());
intent.putExtra("app_uid", getApplicationInfo().uid);

对于Android O up:

<intent android:action="android.settings.APP_NOTIFICATION_SETTINGS">
    <extra android:name="android.provider.extra.APP_PACKAGE" android:value="your app package name" />    
</intent>