RNConnectivityStatusModule.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:react-native-connectivity-status 作者:
/**
 * Asks to enable bluetooth
 */
@ReactMethod
public void enableBluetooth(final Promise promise) {
  try {
    if (!checkBluetooth()) {
      Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
      getReactApplicationContext().startActivityForResult(enableBtIntent, NEAR_BLUETOOTH_SETTINGS_CODE, new Bundle());
    }

    promise.resolve(true);
  } catch (Exception e) {
    promise.reject("BLE_ACTIVATION_ERROR", e.getMessage());
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号