Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 0086d05

Browse files
committed
Merge pull request #42 from beaufortfrancois/promptUserBt
Fixed 2 consecutive bluetooth prompts
2 parents f021531 + ace4302 commit 0086d05

File tree

1 file changed

+2
-5
lines changed
  • app/src/main/java/io/github/webbluetoothcg/bletestperipheral

1 file changed

+2
-5
lines changed

app/src/main/java/io/github/webbluetoothcg/bletestperipheral/Peripheral.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ protected void onCreate(Bundle savedInstanceState) {
174174
mAdvStatus = (TextView) findViewById(R.id.textView_advertisingStatus);
175175
mConnectionStatus = (TextView) findViewById(R.id.textView_connectionStatus);
176176
mBluetoothDevices = new HashSet<>();
177-
// TODO(g-ortuno): This can be moved to Peripherals.
178-
ensureBleFeaturesAvailable();
177+
mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
178+
mBluetoothAdapter = mBluetoothManager.getAdapter();
179179

180180
// If we are not being restored from a previous state then create and add the fragment.
181181
if (savedInstanceState == null) {
@@ -303,9 +303,6 @@ public void run() {
303303
////// Bluetooth //////
304304
///////////////////////
305305
private void ensureBleFeaturesAvailable() {
306-
mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
307-
mBluetoothAdapter = mBluetoothManager.getAdapter();
308-
309306
if (mBluetoothAdapter == null) {
310307
Toast.makeText(this, R.string.bluetoothNotSupported, Toast.LENGTH_LONG).show();
311308
Log.e(TAG, "Bluetooth not supported");

0 commit comments

Comments
 (0)