I'm building a simple app just have authentication functionality, and after users logged in to the app, they can look their phone number(only iphone) on the home page.
Is it possible? If so, how?
Thanks...
Yes for Android
var deviceInformation = cordova.require("cordova/plugin/DeviceInformation");
deviceInformation .get(function(result) {
console.log("result = " + result);
}, function() {
console.log("error");
});
UPDATE
No for iOS
It violates the latest SDK Agreement as of Nov 5, 2009. Here's the response from Apple:
"For security reasons, iPhone OS restricts an application (including its preferences and data) to a unique location in the file system. This restriction is part of the security feature known as the application's "sandbox." The sandbox is a set of fine-grained controls limiting an application's access to files, preferences, network resources, hardware, and so on."
The device's phone number is not available within your application's container. You will need to revise your application to read only within your directory container and resubmit your binary to iTunes Connect in order for your application to be reconsidered for the App Store.
This was a real disappointment since we wanted to spare the user having to enter their own phone number.
Original Answer here
Regards.