1

Asking user the permission to turn device discoverable with the following snippet

final Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);

startActivityForResult(intent, BT_REQUEST);

causes the following system dialog to show up in portrait mode while my calling activity is in landscape, which is not a good user experience.

Many landscape only bluetooth apps I tried from the Play Store seem to suffer the same problem.

Is there any way to force the dialog to appear in landscape mode?

I tried to override system activity orientation from manifest, without success

<activity android:name="com.android.settings.bluetooth.RequestPermissionActivity"
                        android:screenOrientation="landscape" />
ovmjm
  • 1,624
  • 12
  • 15
  • I think, you start another app by using intent, which makes it impossible to use landscape. So maybe you can make a confirmation alert dialog inside your app and send Bluetooth adapter positive or negative selection automatically from your dialog. – Hasan Saykın Jul 07 '17 at 08:48
  • For security reasons, I think it is not possible.. – ovmjm Jul 09 '17 at 09:36
  • Check out ifeegoo's answer to this question, https://stackoverflow.com/questions/6546083/how-to-turn-on-bluetooth-on-button-click . But as you said, and ifeegoo states, security might block turning on bluetooth if you use enable() method. – Hasan Saykın Jul 09 '17 at 10:21

0 Answers0