我可以在 Android 上通过 HTML 拨打电话吗?
要在 iPhone 上通过 HTML 拨打电话,我创建了一个 标记,其 href 格式为:
拨打我电话
。
Android 上有 HTML 的等效项吗?
澄清 - 使用格式 href='tele:123-555-1212' 确实适用于 Android。我正在设备上的本机 Java 包装器中测试该应用程序。我们似乎无法从本机包装器中托管的 Web 应用程序进行调用。
To make a phone call via HTML on an iPhone I create an <A/>
tag with an href formatted as: <a href='tel:123-555-1212'>Dial Me</a>
.
Is there an equivelant for HTML on Android?
CLARIFICATION - using the format href='tele:123-555-1212' does indeed work on on android. I was testing the app within a native Java wrapper on the device. It does not appear as if we can make a call from a web application hosted in a Native Wrapper.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,你可以;它也适用于 Android :
Android 浏览器使用电话应用程序来处理“tel”方案,如 RFC 3966 所定义。
在 Android 上单击类似以下的链接
将打开“电话”应用程序并预先输入 2125551212 的数字,而不会自动拨号。
查看 RFC3966
Yes you can; it works on Android too:
The Android browser uses the Phone app to handle the “tel” scheme, as defined by RFC 3966.
Clicking a link like:
on Android will bring up the Phone app and pre-enter the digits for 2125551212 without autodialing.
Have a look to RFC3966
我刚刚编写了一个可以从网页进行调用的应用程序 - 我不知道这对您是否有任何用处,但无论如何我都包括:
在您的 onCreate 中,您需要使用 webview 并分配 WebViewClient,如下:
然后像这样处理电话号码的点击:
如果您需要更多指示,请告诉我。
I have just written an app which can make a call from a web page - I don't know if this is any use to you, but I include anyway:
in your onCreate you'll need to use a webview and assign a WebViewClient, as below:
then handle the click on a phone number like this:
Let me know if you need more pointers.
一般来说,在 Android 上,如果您只是显示电话号码,然后用户点击它,它就会在拨号器中将其拉出。因此,您可以简单地执行以下操作:
当用户点击粗体部分时,由于其格式类似于电话号码,因此会弹出拨号器,并在电话号码字段中显示
4165551234
。然后用户只需按下呼叫按钮即可。您也许可以
覆盖这两种设备,但我不确定这效果如何。我很快就会尝试一下并通知您。
编辑:
我刚刚在我的 HTC Magic 上尝试了一下,运行了 rooted Rogers 1.5 和 SenseUI:
第一个,周围有链接并打印了电话号码,工作得很好。拉出带有连字符和所有内容的拨号器。第二个,通过链接说出
我们的号码
,其工作原理完全相同。这意味着使用应该可以全面工作,但我不建议将我的一次测试作为结论。
直接链接到该号码达到了预期目的:尝试从服务器中提取不存在的文件。
最后一个按照我上面提到的那样做了,并拉出了拨号器,但没有漂亮的格式化连字符。
Generally on Android, if you simply display the phone number, and the user taps on it, it will pull it up in the dialer. So, you could simply do
When the user taps on the bold part, since it's formatted like a phone number, the dialer will pop up, and show
4165551234
in the phone number field. The user then just has to hit the call button.You might be able to do
to cover both devices, but I'm not sure how well this would work. I'll give it a try shortly and let you know.
EDIT:
I just gave this a try on my HTC Magic running a rooted Rogers 1.5 with SenseUI:
The first one, surrounding with the link and printing the phone number, worked perfectly. Pulled up the dialer with the hyphens and all. The second, saying
our number
with the link, worked exactly the same. This means that using<a href='tel:xxx-xxx-xxxx'>
should work across the board, but I wouldn't suggest taking my one test as conclusive.Linking straight to the number did the expected: Tried to pull up the nonexistent file from the server.
The last one did as I mentioned above, and pulled up the dialer, but without the nice formatting hyphens.