电脑app权限设置在哪里

发布时间: 2023-04-16 14:22 阅读: 文章来源:转载
/** * 1,设置手机通知权限 */setPermissionsInform() {// #ifdef APP-PLUSif (plus.os.name == ‘Android‘) {// 判断是Androidvar main = plus.android.runtimeMainActivity();var pkName = main.getPackageName();var uid = main.getApplicationInfo().plusGetAttribute(‘uid‘);var NotificationManagerCompat = plus.android.importClass(‘android.support.v4.app.NotificationManagerCompat‘);//android.support.v4升级为androidxif (NotificationManagerCompat == null) {NotificationManagerCompat = plus.android.importClass(‘androidx.core.app.NotificationManagerCompat‘);}var areNotificationsEnabled = NotificationManagerCompat.from(main).areNotificationsEnabled();// 未开通‘允许通知’权限,则弹窗提醒开通,并点击确认后,跳转到系统设置页面进行设置if (!areNotificationsEnabled) {uni.showModal({title: ‘通知权限开启提醒‘,content: ‘您还没有开启通知权限,无法接受到消息通知,请前往设置!‘,showCancel: false,confirmText: ‘去设置‘,success: function (res) {if (res.confirm) {var Intent = plus.android.importClass(‘android.content.Intent‘);var Build = plus.android.importClass(‘android.os.Build‘);//android 8.0引导if (Build.VERSION.SDK_INT >= 26) {var intent = new Intent(‘android.settings.APP_NOTIFICATION_SETTINGS‘);intent.putExtra(‘android.provider.extra.APP_PACKAGE‘, pkName);} else if (Build.VERSION.SDK_INT >= 21) {//android 5.0-7.0var intent = new Intent(‘android.settings.APP_NOTIFICATION_SETTINGS‘);intent.putExtra(‘app_package‘, pkName);intent.putExtra(‘app_uid‘, uid);} else {//(
•••展开全文
相关文章