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

Is it possible to call doInBackground from onPostExecute?
Endless recyclerview stackFromEnd type like Whatsapp
I am not able to fetch and delete data from Sq-lite
Google Fit API Activity History
Navigating fragments
Using protobuf-net in android
Android shouldShowRequestPermissionRationale has a bug?
Progress Bar while seekbar fills up as well as when switching images
Android, how to get app on foreground
Unable to filter listview in fragment
Do I have to worry about non-power-of-two textures on API 16+?
Adding custom layout to PreferenceFragment
Close image effect on drag up or down fragment
How to pass HashMap<String,List<String>> from intent
Cannot run android aplication - appcompat_v7 not found -
Android game development

Categories

HOME
api
spark-streaming
linkedin
phpmyadmin
formal-languages
numbers
jsf-2.2
nuget
tivoli
cq5
hugo
mvc5
flume
teechart
dkim
distribution
plist
x-cart
automatic-ref-counting
pybossa
asp.net-core-webapi
user-experience
poedit
angular-routing
zxing
short-url
bulletphysics
motion-detection
bringtofront
finagle
send
aws-codecommit
mobx
turfjs
r-grid
card.io
jett
reactjs.net
pop3
mnist
ods
diacritics
resolution
portforwarding
facebook-social-plugins
puredata
term
serde
identification
compiler-design
bbpress
payload
flyout
trigger.io
cd-burning
custom-lists
redistributable
jboss-tools
hclust
pre-build-event
android-wake-lock
database-relations
beanstalk
aspen
relativelayout
linklabel
google-books
ons-api
baasbox
bcache
adehabitathr
cryptographichashfunction
ghcjs
jqmodal
unix-socket
terminate
qscrollarea
getopt
eclipse-kepler
light
mysql-error-1044
oocss
nevron
twisted.web
mkv
saleslogix
failing-tests
flex-mobile
entity-attribute-value
listactivity
openfaces
pos-for-.net
windows-identity
sqlobject
ifilter
lemmatization
great-circle

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