How can I get the device's phone number through JavaScript in Android?

前端 未结 2 1438
北海茫月
北海茫月 2021-01-17 01:10

I want to get device phone number through JavaScript for validating user.

I am sending sms to client when he clicks on a URL I need to perform some operation

相关标签:
2条回答
  • 2021-01-17 01:39

    If your javascript is part of a webpage and is displayed in Android browser than you are out of luck. It behaves the same way as javascript on other browsers - it can't access any underlying operating system functions.

    On the other hand if your javascript is part of installable Android application (and executed in WebView) then javascript can call your custom Java function which provides this info. Of course your application will have to request the privilege to access personal info at install time and user will have to confirm this.

    0 讨论(0)
  • 2021-01-17 01:39

    Ask them to enter in into a form - otherwise Ankit is right, it's a security / privacy issue. They might not want you to know their number.

    0 讨论(0)
提交回复
热议问题