I am developing and app to Send BLE Advertisement packet in android. I have use AdvertiseData and AdverstiseSettings classes to generate the advertise packet. But when i do
See this question for a possible answer, BLE Advertisments are not supported on every device.
Also try to omit the device name as suggested here.
From my experience there are 4 types of Android devices in regard BLE advertisement:
Note: in the 2., 3. and 4. the BluetoothLeAdvertiser object is returned ONLY when Bluetooth is ON. Otherwise null is returned, so you actually have no clue whether the device supports LE Advertisement or not until Bluetooth is enabled.
Check the nRF Connect app: Disable Bluetooth, install the app, open and select Advertiser tab or Navigation menu -> Device information. It will ask you to turn Bluetooth ON before the status will be shown.
You only need to add this code: @TargetApi(Build.VERSION_CODES.M)
over your method