I'm asking questions to Android bl experts

Asked 2 years ago, Updated 2 years ago, 48 views

mAdvSettings = new AdvertiseSettings.Builder()
        .setAdvertiseMode( AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY )
        .setTxPowerLevel( AdvertiseSettings.ADVERTISE_TX_POWER_HIGH )
        .setConnectable( false )
        .build();

ParcelUuid pUuid = new ParcelUuid( UUID.fromString( "CDB7950D-73F1-4D4D-8E47-C090502DBD63"));
mAdvData = new AdvertiseData.Builder()
        .addServiceUuid( pUuid )
        .addServiceData( pUuid, "aa".getBytes( Charset.forName( "UTF-8" ) ) )
        .build();

mAdvScanResponse = new AdvertiseData.Builder()
    .setIncludeDeviceName(true)
    .build();

....

  mAdvertiser = mBluetoothAdapter.getBluetoothLeAdvertiser();
  mAdvertiser.startAdvertising(mAdvSettings, mAdvData, mAdvScanResponse, mAdvCallback);

I would like to create a beacon signal by creating an advertising message as shown above in the Android code So I tried to make it non-connectable by giving setConnectable as false.

When I checked the ble packet with the BLE dongle sold by Nordic, the Advertising Type came out as Discoverable as shown below.

In the beacon module that I am testing around, the Advertising Type is well displayed as non-connectable.

However, if you switch to the code left above on the Samsung Galaxy S7 edge, it will be displayed as a Discoverable type. What should I do to change this to a non-connectable type?

If you can't change it, I'd like to know the difference between the discoverable type and the non-connectable type.

ble android

2022-09-22 15:12

1 Answers

I solved it.

mAdvertiser.startAdvertising(mAdvSettings, mAdvData, mAdvScanResponse, mAdvCallback);

If you use the startAdvertising method that does not use the mAdvScanResponse parameter in this part, it is sent as non=connectable type. ^

^

mAdvertiser.startAdvertising(mAdvSettings, mAdvData, mAdvCallback); Like this


2022-09-22 15:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.