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
1 changed files with 5 additions and 4 deletions

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) {