Amirahmad Chapneviss
Amirahmad Chapneviss

Reputation: 21

Bluetooth in Android: how to access my Bluetooth address?

This is a very simple question: how can I get my Bluetooth address in Android and save it into an string ?

Upvotes: 0

Views: 185

Answers (2)

Amesys
Amesys

Reputation: 836

From here: http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html

String MAC_ADDR = BluetoothAdapter.getDefaultAdapter().getAdress();

Don't forget the following: <uses-permission android:name="android.permission.BLUETOOTH" />

Have you search for it before posting?

Upvotes: 2

Xema
Xema

Reputation: 1886

You can do the following :

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
String address = mBluetoothAdapter.getAddress();

Upvotes: 1

Related Questions