设置中的定位服务页面如何打开?

定位功能中,当检测到没有开启定位服务时,需要引导用户跳转到定位服务开启页面,该页面如何开启

阅读 489
1 个回答

跳转开启我的定位权限页面参考demo:

import common from '@ohos.app.ability.common';
import Want from '@ohos.app.ability.Want';

@Entry
@Component
struct Index6 {
  @State message: string = 'Hello World';

  build() {
    Row() {
      Column() {
        Button("to访问我的位置信息").onClick(()=>{
          let context = getContext(this) as common.UIAbilityContext;
          let want: Want = {
            bundleName: 'com.example.xxx.settings',
            abilityName: 'com.example.xxx.settings.MainAbility',
            uri: "location_manager_settings",//消息通知传uri:systemui_notification_settings, 蓝牙传uri:bluetooth_entry, Wi-Fi传uri:wifi_entry,定位权限传uri:location_manager_settings
          };
          console.log("want",want)
          context.startAbility(want)
        }).margin(10)
      }
      .width('100%')
    }
    .height('100%')
  }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进