android


How to find bluetooth mac address programmatically in Android api level 19


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!
As far as I know, Bluetooth is not supported by default neither on standard emulator nor on genymotion(There were rumours that Bluetooth will be supported by genymotion). You can enable bluetooth on your VirtualBox-based emulator which is described here but I didn't try it.
Retrieving BluetoothAdapter from static method BluetoothAdapter.getDefaultAdapter() is correct for all Platforms. BluetoothManager is available from API 18.

Related Links

Change the status using the position in a listview
a function of android:how to use the function of “inflate(int resource, ViewGroup root, boolean attachToRoot)”
How to work with Android ListView setOnScrollListener?
SCREEN_OFF BroadcastReceiver is not working
How to send small picture as a text message in android
Is it normal that the size of apk build under Android Stuio is larger than the same apk build under code base
Install offline SDK in Android Studio and use Eclipse SDK in Android Studio
Set focus on view inside ScrollView
How to send Verification/Confirmation Email when user have registered in Android?
How to create an icon in custom layout in Microsoft band?
how to make app a percent of the screen size
Constantly losing storage after Cordova 6.0.0 update
Detect Keyboard showing when `android:windowSoftInputMode=“adjustPan”`
Android make button 1/3 of screen width and height in relative layout
Android Recyclerview not showing if placed inside the other layouts
Forbid scroll recyclerview if focus edittext

Categories

HOME
phpword
ng-idle
object
numbers
mstest
mips
nested-if
iis-6
jtextpane
barcode
p2p
alamofire
cmdb
automatic-ref-counting
comsol
frequency-distribution
shared-libraries
scrolltop
selectize.js
symbol
scsi
symfony-2.8
template-engine
apache2.4
articulate-storyline
object-storage
highstock
pic32
entity-relationship-model
cppreference
sqsh
xbox
recurring-events
fstream
slacktextviewcontroller
servicestack-text
salesforce-communities
sql-server-ce
google-data-api
c9.io
naming
android-ibeacon
importerror
signal-strength
puredata
vaadin-elements
mongotemplate
singleinstance
truezip
avx
flyout
gameplay-kit
cd-burning
rxtx
structuremap4
visual-studio-2008-sp1
angular2-testing
model-associations
mapinfo
jclouds
deep
riot
yajsw
aspen
contentcontrol
spring-retry
toran-proxy
iokit
rewrite
ocra
sql-server-data-tools
alloy-ui
umlgraph
procedural-programming
nodelist
unix-socket
dct
draw2d-js
dsym
square-bracket
solace-mq
inappsettingskit
mongohq
neos-server
android-icons
stacky
curb
listactivity
quotation-marks
resharper-6.0
updatesourcetrigger
folding
lobo-cobra
fdf
sqlobject

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App