Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native ios get mac address

In the react-native application I use the react-native-device-info library to get the MAC address of the device.

But I can only get the mac address of Android devices. I could not find a library to get the mac address of iOs devices.

How do I get the MAC address of iOs devices?

like image 422
Sercan Yeniyurt Avatar asked May 01 '18 01:05

Sercan Yeniyurt


People also ask

How do I get the device info in react-native?

To get the device information in React Native will use the react-native-device-info library.

How can I get MAC address?

From Home, tap Menu > Settings > About Phone/Device. Tap either Status or Hardware Information. Scroll down to WiFi MAC address.


1 Answers

There is no way of doing this in iOS 7 or later, citing apple:

In iOS 7 and later, if you ask for the MAC address of an iOS device, the system returns the value 02:00:00:00:00:00. If you need to identify the device, use the identifierForVendor property of UIDevice instead.


Instead, you should use "identifierForVendor" which could be received with react-native-device-info:

import DeviceInfo from 'react-native-device-info'; 

const uniqueId = DeviceInfo.getUniqueID();
like image 134
Henning Hall Avatar answered Sep 20 '22 11:09

Henning Hall