Detect device phone number

  

On a mobile web app, is there a way to detect the user's phone number?


I'd like to prompt the user "Allow site/app to access your device's phone number?" ... if yes, then this would be great because the user would not have to manually enter their phone number.


Thanks!

João Neves wrote:

Hi Bruce,

Check out this plugin:

https://www.outsystems.com/forge/component/1662/sim-plugin/

Awesome, I will try that on my next mobile app for sure. Is there anything out there for mobile-web apps?


Hi, I tried use the "SIM-PLUGIN" for get mobile number, however I just obtained CountryCode, NetworkType and CarrierName. Is need do a configuration or something?

I would say this is not possible in iOS, if you want to publish it to the AppStore, for privacy reasons I guess. Apple prohibits access to the phone number programmatically, even at the native apis level. Check https://stackoverflow.com/questions/193182/programmatically-get-own-phone-number-in-ios

That’s why apps such as WhatsApp still ask the user to input their number.

In Android it should be possible. Check https://stackoverflow.com/questions/32005570/cordova-phonegap-get-phone-number-of-device-android-ios for details and pointers to a Cordova plugin that can get phone number in Android.

If you’re targeting both platforms... I’d say just review your user experience to ask the number to the user.

I’m not 100% sure about iOS B2E apps/enterprise distribution, but read somewhere that you need a specific, custom entitlement, to call the device API, that Apple won’t allow you to add to the provisioning profile anyway. Maybe it is possible if you have an MDM such as AirWatch or similar that would provide such an SDK and sign the app to be distributed internally.


Gonçalo Borrêga escribió:

Yo diría que esto no es posible en iOS, si quieres publicarlo en la AppStore, por razones de privacidad, supongo. Apple prohíbe el acceso al número de teléfono mediante programación, incluso a nivel de API nativo. Verifique https://stackoverflow.com/questions/193182/programmatically-get-own-phone-number-in-ios

Es por eso que aplicaciones como WhatsApp aún le piden al usuario que ingrese su número.

En Android debería ser posible. Consulte https://stackoverflow.com/questions/32005570/cordova-phonegap-get-phone-number-of-device-android-ios para obtener detalles y sugerencias sobre un complemento de Cordova que puede obtener el número de teléfono en Android.

Si tiene como objetivo ambas plataformas ... Yo diría que simplemente revise su experiencia de usuario para preguntar el número al usuario.

No estoy 100% seguro acerca de las aplicaciones B2E de iOS / distribución empresarial, pero lea en alguna parte que necesita un derecho específico y personalizado para llamar a la API del dispositivo, que de todos modos Apple no le permitirá agregar al perfil de aprovisionamiento. Tal vez sea posible si tiene un MDM como AirWatch o similar que proporcione un SDK de este tipo y firme la aplicación para que se distribuya internamente.


Thanks so much. I have it more clear.