Only show Bluetooth dialog if Bluetooth is disabled.
This commit is contained in:
parent
7e71d231c9
commit
6a546d97a3
|
@ -35,10 +35,11 @@ class MainActivity extends EnsiChatActivity {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
val intent: Intent = new
|
if (BluetoothAdapter.getDefaultAdapter.isEnabled) {
|
||||||
Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE)
|
val intent: Intent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE)
|
||||||
intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0)
|
intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0)
|
||||||
startActivityForResult(intent, RequestSetDiscoverable)
|
startActivityForResult(intent, RequestSetDiscoverable)
|
||||||
|
}
|
||||||
|
|
||||||
val fm = getFragmentManager
|
val fm = getFragmentManager
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
|
|
Reference in New Issue