1

Hi i want to get my own bluetooth mac address.how can i get the local mac address? I have tried scanning by one of the react native package.it gets all the bluetooth mac address whose bluetooth is on.However i couldn't get the local mac address of my own phone's bluetooth which is running the application

bikram basnet
  • 149
  • 3
  • 8

1 Answers1

0

I really don't think a package that would provide this exists, it's quite a niche thing.

You'll need to make your own native module, see this example: https://facebook.github.io/react-native/docs/native-modules-android.html

Then you can use this to get the MAC address on Android:

  String macAddress = android.provider.Settings.Secure.getString(context.getContentResolver(), "bluetooth_address");
tmartykan
  • 48
  • 1
  • 4
  • i know nothing about java could you help building this. – bikram basnet Jun 18 '17 at 12:43
  • @tmartykan Thanks for your answer, looks promising. Do you have a full example for us? Eg. a gist or other link to one? Would be awesome. Thanks in advance. – natterstefan Jan 11 '18 at 15:29
  • Unfortunately [that won't help](https://stackoverflow.com/a/45564702/435004) — Reading the Bluetooth MAC address is a privilege that can only be granted to apps baked into a system image (i.e. by phone vendors). – DomQ Sep 06 '19 at 14:45