Reputation: 143
If i check this
bluetoothadapter.isMultipleAdvertisementSupported();
with my Bluetooth disable, it returns false... and if is enable, it returns true.
What i am trying to do is that if the bluetooth is disable, enable it (i do this programaticaly and is working fine) and then check for isMultipleAdvertisementSupported(), but when i do this, it returns false instead of true. It seems i have to wait a little bit until bluetooth is fully enabled. Do i have a listener or callback for this? what can i do?
Upvotes: 0
Views: 826
Reputation: 64941
I have seen the same on several device models where isMultipleAdvertisementSupported()
returns false for a few seconds after bluetooth power-on.
You can register a BroadcastReceiver
to be called on <action android:name="android.bluetooth.adapter.action.STATE_CHANGED"/>
, but I have not tried to see if the isMultipleAdvertisementSupported()
consistently returns true after you get the callback with BluetoothAdapter.STATE_ON
.
You can see details on how to set this up here: On Android, can I register for a callback that tells me if Bluetooth is turned on or off?
If you try this, please comment on whether this gives you consistent results with isMultipleAdvertisementSupported()
post-callback.
Upvotes: 2