Only show Bluetooth dialog if Bluetooth is disabled.

This commit is contained in:
Felix Ableitner 2015-02-25 20:33:58 +01:00
parent 7e71d231c9
commit 6a546d97a3

View file

@ -35,10 +35,11 @@ class MainActivity extends EnsiChatActivity {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val intent: Intent = new
Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE)
intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0)
startActivityForResult(intent, RequestSetDiscoverable)
if (BluetoothAdapter.getDefaultAdapter.isEnabled) {
val intent: Intent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE)
intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0)
startActivityForResult(intent, RequestSetDiscoverable)
}
val fm = getFragmentManager
if (savedInstanceState != null) {