如何拉起设置蓝牙页面?

如何拉起设置蓝牙页面

阅读 370
1 个回答

示例代码

import common from '@ohos.app.ability.common'; 
import Want from '@ohos.app.ability.Want'; 
 
@Entry 
@Component 
struct Index { 
  build() { 
    Row() { 
      Column() { 
        Button('拉起蓝牙页面', { type: ButtonType.Normal, stateEffect: true }) 
          .borderRadius(8) 
          .backgroundColor(0x317aff) 
          .width(90) 
          .onClick(() => { 
            this.startAbilityTest() 
          }) 
      } 
      .width('100%') 
    } 
    .height('100%') 
  } 
 
  startAbilityTest() { 
    let context = getContext(this) as common.UIAbilityContext; 
    let want: Want = { 
      bundleName: 'com.huawei.hmos.settings', 
      abilityName: 'com.huawei.hmos.settings.MainAbility', 
      uri: 'bluetooth_entry', 
    }; 
    context.startAbility(want); 
  } 
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进