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

Android Annotations + RestTemplate - get response xml as string
Cocos2d-x game crashes on Android Emulator
Android Studio - Build Failed after import project with facebook sdk and jsoup 1.7.2 sources.jar
Applescript do shell script can't find Android ADB
Receiving Messages in an Android GCM app, with a HTTP server (not CCS/XMPP)
ScriptIntrinsicBlur produces black bitmaps
Android Is it possible to change how dialog looks?
Detecting state of application resume from different navigation state android
How to add ListView items on button click using adapter
Unable to create AVD — System images installed, restarted eclipse and verified SDK path — still no luck
Imprecise Box2d coordinates using LibGDX
Register action at future intervals
Parse XML in Android from Prestashop webservice
Android start service issue in onCreate of Activity
Remove css file from epub
Relocate “My Location” Button in Google Maps v1

Categories

HOME
assembly
forms
fpga
mstest
xbee
google-apps
pyqt4
gembox-spreadsheet
regular-language
google-cloud-datalab
spin
appcelerator-studio
scsi
package.json
mvc-mini-profiler
dreamweaver
topology
symbols
googlebot
articulate-storyline
flask-sqlalchemy
monit
displaytag
custom-post-type
genexus-sd
finagle
zend-debugger
mockjax
code-snippets
carriage-return
parse-tree
openalpr
flatmap
azure-arm
subclipse
android-exoplayer
rfc3339
dotnet-httpclient
lightning
singleinstance
check-mk
gpg-signature
ampps
sandcastle
chromium-os
angular2-testing
macaulay2
dup
lean
google-query-language
cda
database-relations
jparsec
httpruntime.cache
linklabel
dynatree
poppler
mmwormhole
apache-spark-1.3
sonarqube-5.0
encryption-asymmetric
unix-socket
lnk
wxformbuilder
ios8-extension
vsx
authlogic
drupal-nodes
android-audiorecord
accesscontrolexception
node-blade
octal
composite-component
alice
tree-balancing
lambdaj
multiplexing
predicatebuilder
wiimote
agility.js
procedures
catransform3d
google-ajax-api
rmdir
non-clustered-index
web-application-project
tui
alsb

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