中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

wordpress獨(dú)立頁(yè)面開發(fā)北京seo服務(wù)商找行者seo

wordpress獨(dú)立頁(yè)面開發(fā),北京seo服務(wù)商找行者seo,網(wǎng)站整合建設(shè)方案,肥西縣建設(shè)局官方網(wǎng)站一. 權(quán)限分類 1. system_grant system_grant 為系統(tǒng)授權(quán),無(wú)需詢問(wèn)用戶,常用的權(quán)限包括網(wǎng)絡(luò)請(qǐng)求、獲取網(wǎng)絡(luò)信息、獲取wifi信息、獲取傳感器數(shù)據(jù)等。 /* system_grant(系統(tǒng)授權(quán))*/static readonly INTERNET ohos.permission.INTE…

一. 權(quán)限分類

?1. system_grant

system_grant 為系統(tǒng)授權(quán),無(wú)需詢問(wèn)用戶,常用的權(quán)限包括網(wǎng)絡(luò)請(qǐng)求、獲取網(wǎng)絡(luò)信息、獲取wifi信息、獲取傳感器數(shù)據(jù)等。

/* system_grant(系統(tǒng)授權(quán))*/static readonly INTERNET = 'ohos.permission.INTERNET' // 網(wǎng)路請(qǐng)求static readonly GET_NETWORK_INFO = 'ohos.permission.GET_NETWORK_INFO' // 網(wǎng)絡(luò)信息-讀static readonly GET_WIFI_INFO = 'ohos.permission.GET_WIFI_INFO' // WIFI信息-讀static readonly GYROSCOPE = 'ohos.permission.GYROSCOPE' // 陀螺儀傳感器static readonly ACCELEROMETER = 'ohos.permission.ACCELEROMETER' // 加速度傳感器

2. user_grant

user_grant 是需要用戶授權(quán)的權(quán)限,常用的權(quán)限包括定位、相機(jī)、麥克風(fēng)、日歷、文件讀寫等。

/* user_grant(用戶授權(quán))*/static readonly LOCATION = 'ohos.permission.LOCATION' // 定位-精確static readonly APPROXIMATELY_LOCATION = 'ohos.permission.APPROXIMATELY_LOCATION' // 定位-模糊static readonly LOCATION_IN_BACKGROUND = 'ohos.permission.LOCATION_IN_BACKGROUND' // 定位-后臺(tái)static readonly CAMERA = 'ohos.permission.CAMERA' // 相機(jī)static readonly MICROPHONE = 'ohos.permission.MICROPHONE' // 麥克風(fēng)static readonly READ_CONTACTS = 'ohos.permission.READ_CONTACTS' // 通訊錄-讀static readonly WRITE_CONTACTS = 'ohos.permission.WRITE_CONTACTS' // 通訊錄-寫static readonly READ_CALENDAR = 'ohos.permission.READ_CALENDAR' // 日歷-讀static readonly WRITE_CALENDAR = 'ohos.permission.WRITE_CALENDAR' // 日歷-寫static readonly WRITE_IMAGEVIDEO = 'ohos.permission.WRITE_IMAGEVIDEO' // 圖片視頻-寫static readonly READ_IMAGEVIDEO = 'ohos.permission.READ_IMAGEVIDEO' // 圖片視頻-讀static readonly MEDIA_LOCATION = 'ohos.permission.MEDIA_LOCATION' // 多媒體-本地static readonly WRITE_AUDIO = 'ohos.permission.WRITE_AUDIO' // 音頻-寫static readonly READ_AUDIO = 'ohos.permission.READ_AUDIO' // 音頻-讀static readonly READ_MEDIA = 'ohos.permission.READ_MEDIA' // 文件-讀static readonly WRITE_MEDIA = 'ohos.permission.WRITE_MEDIA' // 文件-寫static readonly APP_TRACKING_CONSENT = 'ohos.permission.APP_TRACKING_CONSENT' // 廣告標(biāo)識(shí)符static readonly DISTRIBUTED_DATASYNC = 'ohos.permission.DISTRIBUTED_DATASYNC' // 多設(shè)備協(xié)同static readonly ACCESS_BLUETOOTH = 'ohos.permission.ACCESS_BLUETOOTH' // 使用藍(lán)牙能力static readonly READ_PASTEBOARD = 'ohos.permission.READ_PASTEBOARD' // 剪貼板static readonly READ_HEALTH_DATA = 'ohos.permission.READ_HEALTH_DATA' // 健康數(shù)據(jù)static readonly ACTIVITY_MOTION = 'ohos.permission.ACTIVITY_MOTION' // 健身運(yùn)動(dòng)

二. 權(quán)限聲明?

1. system_grant

在應(yīng)用?entry 模塊的 module.json5 中添加權(quán)限聲明。

"requestPermissions": [{"name": "ohos.permission.INTERNET"}, {"name": "ohos.permission.GET_NETWORK_INFO"}, {"name": "ohos.permission.GET_WIFI_INFO"}
]

?2. user_grant

在應(yīng)用?entry 模塊的 module.json5 中添加權(quán)限聲明。

"requestPermissions": [{"name": "ohos.permission.LOCATION","reason": "$string:PERMISSION_LOCATION","usedScene": {"abilities": ["EntryAbility"],"when":"inuse"}},{"name": "ohos.permission.APP_TRACKING_CONSENT","reason": "$string:PERMISSION_TRACKING_CONSENT","usedScene": {"abilities": ["EntryAbility"],"when":"inuse"}}
]

三. 權(quán)限應(yīng)用?

1. system_grant

使用該類權(quán)限不需要彈窗讓用戶授權(quán),只需要判斷一下該權(quán)限在應(yīng)用中是否聲明。

import { abilityAccessCtrl, bundleManager, PermissionRequestResult, Permissions, Want } from '@kit.AbilityKit';export class PermissionManager {async checkPermissions(): void {const bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)const tokenId = bundleInfo.appInfo.accessTokenIdconst atManager = abilityAccessCtrl.createAtManager()const state = atManager.checkAccessTokenSync(tokenId, 'ohos.permission.INTERNET')if (state === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {console.log('網(wǎng)絡(luò)請(qǐng)求可用')} else {console.log('網(wǎng)絡(luò)請(qǐng)求不可用')}}
}

2. user_grant

使用該類權(quán)限需要先判斷用戶是否授權(quán),先由用戶授權(quán)之后再使用該類權(quán)限相關(guān)的能力。

import { abilityAccessCtrl, bundleManager, PermissionRequestResult, Permissions, common } from '@kit.AbilityKit';export class PermissionManager {async checkPermissions(): Promise<void> {const bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)const tokenId = bundleInfo.appInfo.accessTokenIdconst atManager = abilityAccessCtrl.createAtManager()const state = atManager.checkAccessTokenSync(tokenId, 'ohos.permission.LOCATION')if (state === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {console.log('定位權(quán)限已開啟')} else {const context = AppStorage.get('ability_context') as common.UIAbilityContext // 在EntryAbility中存儲(chǔ)AbilityContextconst result: PermissionRequestResult = await atManager.requestPermissionsFromUser(context, ['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATION'])const authResults: Array<number> = result.authResultsconst grantStatus: boolean = (authResults[0] === 0)if (grantStatus) {console.log('定位權(quán)限已開啟')} else {console.log('定位權(quán)限未開啟')}      }}
}

3. notification

推送通知的權(quán)限是基于 notificationMananger 服務(wù)實(shí)現(xiàn),不同于 system_agent 和 user_agent。

import notificationManager from '@ohos.notificationManager';export class PermissionManager {async checkNotificationPermissions(): Promise<void> {let grantStatus = await notificationManager.isNotificationEnabled()if (!grantStatus) {await notificationManager.requestEnableNotification()grantStatus = await notificationManager.isNotificationEnabled()if (!grantStatus) {console.log('通知權(quán)限未開啟')} else {console.log('通知權(quán)限已開啟')}} else {console.log('通知權(quán)限已開啟')}}
}

4. 跳轉(zhuǎn)到APP設(shè)置頁(yè)

import bundleManager from '@ohos.bundle.bundleManager';
import { common, Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';export class PermissionManager {async gotoSetting(): Promise<void> {const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATIONconst bundleParam = bundleManager.getBundleInfoForSelfSync(bundleFlags)const bundleId = bundleParam.namelet wantInfo: Want = {bundleName: 'com.huawei.hmos.settings',abilityName: 'com.huawei.hmos.settings.MainAbility',uri: 'application_info_entry',parameters: {pushParams: bundleId}}const context = AppStorage.get('ability_context') as common.UIAbilityContext // 在EntryAbility中存儲(chǔ)AbilityContextcontext.startAbility(wantInfo).catch((error: BusinessError) => {console.error(`startAbility-error: ${JSON.stringify(error)}`)})}
}

源碼參考:?harmonyos-permission

http://www.risenshineclean.com/news/66324.html

相關(guān)文章:

  • 備案不關(guān)閉網(wǎng)站的方法seo搜索引擎優(yōu)化是什么
  • 簡(jiǎn)述一下網(wǎng)站的設(shè)計(jì)流程seo網(wǎng)站優(yōu)化
  • 企業(yè)網(wǎng)站的綜合要求是什么互動(dòng)營(yíng)銷成功案例
  • 大型網(wǎng)站建設(shè)平臺(tái)百度應(yīng)用app
  • 怎么做網(wǎng)站記者軟文推廣新聞發(fā)布
  • 找人做網(wǎng)站 多少錢市場(chǎng)調(diào)研怎么做
  • 開o2o網(wǎng)站需要什么手續(xù)百度推廣賬號(hào)
  • 上海電商網(wǎng)站開發(fā)網(wǎng)站推廣的基本方法
  • 編程培訓(xùn)機(jī)構(gòu)出來(lái)的能找到工作嗎抖音seo
  • 醫(yī)藥招商網(wǎng)站大全襄陽(yáng)seo優(yōu)化排名
  • 家裝公司報(bào)價(jià)無(wú)錫seo排名收費(fèi)
  • 肥東縣建設(shè)局網(wǎng)站代發(fā)百度關(guān)鍵詞排名
  • 網(wǎng)站建設(shè)哪家好nuoweb中國(guó)去中心化搜索引擎
  • 廈門微網(wǎng)站制作搜索引擎調(diào)價(jià)工具哪個(gè)好
  • wordpress購(gòu)物網(wǎng)站搜狗輸入法下載安裝
  • wordpress submit 500廣州seo網(wǎng)站營(yíng)銷
  • 如何建立一個(gè)網(wǎng)站要多少錢百度開戶怎么開
  • 龍崗網(wǎng)站制作公司一般多少錢百度官方網(wǎng)站登錄
  • 手機(jī)網(wǎng)站建設(shè)公司網(wǎng)絡(luò)營(yíng)銷策劃方案案例
  • 個(gè)人站長(zhǎng)網(wǎng)站應(yīng)該如何定位網(wǎng)絡(luò)推廣怎么收費(fèi)
  • 上海專業(yè)做網(wǎng)站友情鏈接什么意思
  • 網(wǎng)站建設(shè)怎么付費(fèi)目前搜索引擎排名
  • 一個(gè)網(wǎng)站建設(shè)都需要什么企業(yè)網(wǎng)站的優(yōu)化建議
  • 做網(wǎng)站開封b站推廣怎么買
  • 客戶網(wǎng)站做供應(yīng)商自薦有用嗎百度關(guān)鍵詞搜索指數(shù)
  • dreamweaver屬于什么軟件seo是什么字
  • 關(guān)于網(wǎng)站建設(shè)的通知百度網(wǎng)站流量統(tǒng)計(jì)
  • 南京佛搜做網(wǎng)站公司互聯(lián)網(wǎng)營(yíng)銷具體做什么
  • 南京做網(wǎng)站的有哪些apple日本網(wǎng)站
  • 做網(wǎng)站建設(shè)最好學(xué)什么手機(jī)端競(jìng)價(jià)惡意點(diǎn)擊能防止嗎