intentOpenBluetoothSettings

intentOpenBluetoothSettings

我知道以编程方式打开蓝牙设置。

我做这样的事情:

Intent intentOpenBluetoothSettings = new Intent();
intentOpenBluetoothSettings.setAction(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
startActivity(intentOpenBluetoothSettings);


但是这样做将带我进入同一视图/应用程序中的Bluetooth设置页面。

如果要在应用程序外部的另一个视图/窗口/页面中打开蓝牙设置页面,该怎么办?

我希望这样做的原因是为了使用户不会混淆设置页面和我的应用程序。

谢谢。

更新资料

我尝试做intentOpenBluetoothSettings.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

但是,要让它以另一种视角打开并不是很幸运。

最佳答案

有两种请求启用蓝牙的方法:

intentOpenBluetoothSettings.setAction(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);


要么

intentOpenBluetoothSettings.setAction(BluetoothAdapter.ACTION_REQUEST_ENABLE);


如果它们都不适合您的需求,那么您可能会重新考虑您的想法。

09-05 08:33