【问题标题】:How can I open the settings page in the device using cordova如何使用cordova打开设备中的设置页面
【发布时间】:2015-01-05 18:32:02
【问题描述】:

我正在使用 apache cordova 构建一个应用程序,并且我已经可以使用 the BluetoothSerial plugin 检查蓝牙是否可用。

如果不是,我会重定向到一个页面,在该页面上我有一个按钮来调用设备设置对话框,但我找不到任何如何执行此操作的示例。有可能吗?

我找到了获取 wifi / gps 设置的示例,但没有找到设置页面本身。

【问题讨论】:

    标签: android cordova settings


    【解决方案1】:

    据我所知,您需要本机代码来调用蓝牙设置。

    我假设您知道如何从 javascript 调用 java 方法。调用此代码

    final Intent intent = new Intent(Intent.ACTION_MAIN, null);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    final ComponentName cn = new ComponentName("com.android.settings", 
                  "com.android.settings.bluetoothSettings");
    intent.setComponent(cn);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity( intent);
    

    这应该会打开蓝牙设置。详情请见this

    【讨论】:

      猜你喜欢
      • 2017-04-25
      • 2017-12-03
      • 2019-03-23
      • 2015-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多