Developing my app with react-native , I must obtain the phone number of the cell phone the app is running on. Does anyone have any ideas for that? How would you do it and why?
Developing my app with react-native , I must obtain the phone number of the cell phone the app is running on. Does anyone have any ideas for that? How would you do it and why?
Yes it is possible, through the library https://github.com/pocesar/react-native-sim-data
You install it using the commands:
You import it in your code:
And you get the SIM data using the function:
The object you get has the following structure:
To get the phone number it would be:
NOTE: The number 0 that you see in the properties refers to the number of SIMs that your device has, if your phone is Dual SIM you can get the phone number of both by changing 0 to 1.