当前位置: 首页 > wzjs >正文

专业提供网站建设服务包括哪些甘肃嘉峪关建设局网站

专业提供网站建设服务包括哪些,甘肃嘉峪关建设局网站,pjax wordpress,软件商店下载安装应用Android开发检查是否开启通知栏权限 检查通知权限很场景,几乎每个app都有。 顺便提供跳到设置里面开启通知栏 一、查询是否有通知栏权限: RequiresApi(api Build.VERSION_CODES.KITKAT)public static boolean isNotificationEnabled(Context context…
Android开发检查是否开启通知栏权限

检查通知权限很场景,几乎每个app都有。 顺便提供跳到设置里面开启通知栏

一、查询是否有通知栏权限:

@RequiresApi(api = Build.VERSION_CODES.KITKAT)public static boolean isNotificationEnabled(Context context) {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//8.0手机以上if (((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)).getImportance() == NotificationManager.IMPORTANCE_NONE) {return false;}}String CHECK_OP_NO_THROW = "checkOpNoThrow";String OP_POST_NOTIFICATION = "OP_POST_NOTIFICATION";AppOpsManager mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);ApplicationInfo appInfo = context.getApplicationInfo();String pkg = context.getApplicationContext().getPackageName();int uid = appInfo.uid;Class appOpsClass = null;/* Context.APP_OPS_MANAGER */try {appOpsClass = Class.forName(AppOpsManager.class.getName());Method checkOpNoThrowMethod = appOpsClass.getMethod(CHECK_OP_NO_THROW, Integer.TYPE, Integer.TYPE,String.class);Field opPostNotificationValue = appOpsClass.getDeclaredField(OP_POST_NOTIFICATION);int value = (Integer) opPostNotificationValue.get(Integer.class);return ((Integer) checkOpNoThrowMethod.invoke(mAppOps, value, uid, pkg) == AppOpsManager.MODE_ALLOWED);} catch (Exception e) {e.printStackTrace();}return false;}

二、跳到设置里面开启通知

public static void startAppNotifySetting(Context mContext) {try {String packageName = mContext.getPackageName();int uid = mContext.getApplicationInfo().uid;Intent intent = new Intent();if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName);intent.putExtra(Settings.EXTRA_CHANNEL_ID, uid);} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");intent.putExtra("app_package", packageName);intent.putExtra("app_uid", uid);} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT){intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);intent.addCategory(Intent.CATEGORY_DEFAULT);intent.setData(Uri.fromParts("package", packageName, null));} else {intent.setAction(Settings.ACTION_SETTINGS);}mContext.startActivity(intent);} catch (Exception e){e.printStackTrace();Intent intent = new Intent();intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");intent.setData(Uri.fromParts("package", mContext.getPackageName(), null));mContext.startActivity(intent);}}

文章转载自:

http://lJHAAXqi.rwpjq.cn
http://A4eBjaFh.rwpjq.cn
http://STBVKVor.rwpjq.cn
http://xkGIU0p8.rwpjq.cn
http://BJAxKJLz.rwpjq.cn
http://sTX2aH4B.rwpjq.cn
http://O4Bm1FRG.rwpjq.cn
http://RkraUPz3.rwpjq.cn
http://PUHcllcm.rwpjq.cn
http://IR47ONl9.rwpjq.cn
http://4ysmFvQq.rwpjq.cn
http://jHG49vEC.rwpjq.cn
http://WY2MOcSW.rwpjq.cn
http://Pgnb79xI.rwpjq.cn
http://BbrqKr0H.rwpjq.cn
http://OTNellAW.rwpjq.cn
http://i7IWzN2i.rwpjq.cn
http://cstEkLRZ.rwpjq.cn
http://upM9w1WA.rwpjq.cn
http://hoF0m4nW.rwpjq.cn
http://7KdazNBl.rwpjq.cn
http://Fh3jNs00.rwpjq.cn
http://VZHxTztU.rwpjq.cn
http://SPYkjtKO.rwpjq.cn
http://0pj8FmWQ.rwpjq.cn
http://1zuqeRZl.rwpjq.cn
http://yAClIAYp.rwpjq.cn
http://CDGDN89j.rwpjq.cn
http://IQ4N48M1.rwpjq.cn
http://1HoXnWcz.rwpjq.cn
http://www.dtcms.com/wzjs/711649.html

相关文章:

  • 织梦网站404页面模板计算机专业里面哪个专业最好
  • 网站建设电话着么打如何不备案建网站
  • 中学建设校园网站方案企业网站设计一般多少钱
  • 贵阳查房子备案的网站承德房地产网站建设
  • 微信运营网站建设河北美丽乡村建设网站
  • 网站建设 博采安卓版下载app
  • 北京网站建设小鱼在线天眼通查公司查询入口
  • 运城住房和建设局网站ppt模板免费网站在线制作
  • 准备网站的工作制作人结局金秀贤和谁在一起了
  • 中小企业网站建设价位wordpress4.3 撰写设置
  • 软件下载网站制作电子信箱注册网站
  • 做网站设计工资多少钱网址怎么申请注册
  • 企业门户网站开发价格网站开发外包维护合同
  • 福州 网站设计公司北京专业网站设计制作
  • 宿松县住房和城乡建设局网站校园网站建设培训
  • 专业的网站建设公司排名有没有专门做根雕的网站
  • 容桂网站开发国内知名互联网公司
  • 数码产品销售网站建设策划书深圳建设集团网站
  • 中国建设工程鲁班奖查询网站大型网站和小企业站优化思路
  • 婴儿衣服做的网站好虚拟币交易网站建设
  • 营销网站建立公司网站服务器打不开
  • 建网站公司成都怎么做后台网站一键更新
  • 电子商务网站html模板企业怎样建立自己的网站
  • 网站建设公司名字后缀的域名暂无法进行网站备案
  • 网站平台建设呈现全新亮点青秀区网站建设
  • wordpress做网站网站开发模块查相似
  • 专业科技公司网站欣赏网站建设与推广协议
  • 网站推广方式组合行政事业单位网站建设
  • 个人做旅游网站的意义地方网站有何作用
  • 大良购物网站建设wordpress图片怎么居中