如何在React Native中请求附近的设备Android 12?

问题描述 投票:0回答:1

如何在 Android 12 React Native 中检查附近设备的权限?

喜欢这张图片 enter image description here

android react-native android-12
1个回答
0
投票

我必须使用react-native-permissions中的多个请求

示例代码

requestMultiple(bluetoothPermission)
  .then((result) => {
    if (result[bluetoothPermissionResult] === RESULTS.GRANTED || result[bluetoothPermissionResult] === RESULTS.UNAVAILABLE) {
      //so something
    } else if (result[bluetoothPermissionResult] === RESULTS.BLOCKED || result[bluetoothPermissionResult] === RESULTS.DENIED) {
      //do something
    }
  })
  .catch((error) => {})
© www.soinside.com 2019 - 2024. All rights reserved.