I need to find bluetooth mac address in android. Below code
BluetoothAdapter.getDefaultAdapter().getAddress();
It works fine with api level 18 and below.
How to find the same with api level 19.?
"To get a BluetoothAdapter representing the local Bluetooth adapter, when running on JELLY_BEAN_MR1 and below, call the static getDefaultAdapter() method; when running on JELLY_BEAN_MR2 and higher, retrieve it through getSystemService(String) with BLUETOOTH_SERVICE" from http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html
I am getting the following error:
bluetooth binder is null
with both
BluetoothManager ba=(BluetoothManager)getSystemService(Context.BLUETOOTH_SERVICE);
bmac=ba.getAdapter().getAddress();
and
bmac=BluetoothAdapter.getDefaultAdapter().getAddress();
on emulator and genymotion emulator for api level 19,kitkat
Help!