1、判断是否打开

NotificationManagerCompat notification = NotificationManagerCompat.from(this);boolean isEnabled = notification.areNotificationsEnabled();

2、跳转系统设置

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BASE) {    // 进入设置系统应用权限界面    Intent intent = new Intent(Settings.ACTION_SETTINGS);    startActivity(intent);    return;} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {// 运行系统在5.x环境使用    // 进入设置系统应用权限界面    Intent intent = new Intent(Settings.ACTION_SETTINGS);    startActivity(intent);    return;}

跳转应用系统设置

public static final String SETTINGS_ACTION =        "android.settings.APPLICATION_DETAILS_SETTINGS";

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BASE) {            Intent intent = new Intent()                    .setAction(SETTINGS_ACTION)                    .setData(Uri.fromParts("package",                            getApplicationContext().getPackageName(), null));            startActivity(intent);            return;        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {            Intent intent = new Intent()                    .setAction(SETTINGS_ACTION)                    .setData(Uri.fromParts("package",                            getApplicationContext().getPackageName(), null));            startActivity(intent);            return;        }


更多相关文章

  1. Android(安卓)开机自启和后台自启权限
  2. android 6.0 创建文件或文件夹失败
  3. Android(安卓)GridView 例子
  4. Android下基于OpenGL的程序会发生纹理丢失的原因
  5. Android(安卓)APP 启动时间统计
  6. Android判断是否有网络连接
  7. Android(安卓)读取安装的非系统应用程序
  8. Android样式设计
  9. AndroidManifest.xml文件详解(supports-screens)

随机推荐

  1. 【Android】Activity Window WMS源码关系
  2. Android(安卓)IPC进程间通讯机制
  3. Android基础入门教程——8.1.2 Android中
  4. Soloπ:支付宝开源的Android专项测试工具
  5. Android中的对话框的使用技巧
  6. Android第六个功能:XmlPullParser解析XML
  7. Android(安卓)-- 基础
  8. Android代码混淆-添加了Gson遇到的问题
  9. 关于Android的Run as 不出现Android Appl
  10. 【Android】沉浸式状态栏完美解决方案