我怎样才能在Android中得到设备的电话号码通过JavaScript?电话号码、设备、Android、JavaScript

2023-09-05 01:20:28 作者:你别太得瑟了

我想获得设备的电话号码,通过JavaScript来验证用户。

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.

对于这一点,我想在智能手机设备的电话号码。

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

推荐答案

如果您的JavaScript是网页的一部分,并且比你的运气了显示在Android浏览器。它的行为方式相同的JavaScript在其他浏览器 - 它不能访问任何基本的操作系统功能

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.

在另一方面,如果你的JavaScript是安装Android应用程序的一部分(而在web视图执行),那么JavaScript可以调用自定义的Java功能,它提供了这个信息。当然,你的应用程序将有权要求特权访问个人信息在安装时和用户都可以证实这一点。

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.