开发者

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

开发者 https://www.devze.com 2023-01-21 06:03 出处:网络
I want to g开发者_开发问答et 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.

I want to g开发者_开发问答et 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.

For that, I want to get device phone number on smartphones.


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号