Can I make a phone call from HTML on Android?

To make a phone call via HTML on the iPhone, I create a <A/> tag with href formatted as: <a href='tel:123-555-1212'>Dial Me</a> .

Is there an equivalent for HTML on Android?

CONFIRMATION - using the format href = 'tele: 123-555-1212' really works on android. I tested the application inside my own Java shell on the device. It does not look like we can make a call from a web application hosted in Native Wrapper.

+74
android html phone-call
May 05 '10 at 14:45
source share
3 answers

Yes, you can; It works on Android :

tel: phone_number
Calls up the entered phone number. Valid phone numbers as defined in IETF RFC 3966 are accepted. Important examples are the following:

 * tel:2125551212 * tel: (212) 555 1212 

The Android browser uses the Phone application to process the tel scheme, as defined in RFC 3966.
By clicking on the link, like:

 <a href="tel:2125551212">2125551212</a> 

on Android, the Phone application will appear and enter the numbers for 2125551212 without autosaving.

Take a look at RFC3966

+115
May 05 '10 at 2:59
source share

I just wrote an application that can make a call from a web page - I don’t know if this is suitable for you, but I still include:

in your onCreate you will need to use webview and assign a WebViewClient as shown below:

 browser = (WebView) findViewById(R.id.webkit); browser.setWebViewClient(new InternalWebViewClient()); 

then process the click on the phone number as follows:

 private class InternalWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.indexOf("tel:") > -1) { startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url))); return true; } else { return true; } } } 

Let me know if you need more pointers.

M

+21
May 05 '10 at 16:28
source share

As a rule, on Android, if you just show the phone number and the user clicks on it, he will drag it in the dialer. So you can just do

 For more information, call us at <b>416-555-1234</b> 

When the user clicks the bold part, as it is formatted as a phone number, a dialer will appear and show 4165551234 in the phone number field. Then the user just needs to press the call button.

Perhaps you can do

 For more information, call us at <a href='tel:416-555-1234'>416-555-1234</a> 

to cover both devices, but I'm not sure how much this will work. I will give it a try soon and let you know.

EDIT: I just tried my HTC Magic using root Rogers 1.5 with SenseUI:

 For more information, call us at <a href='tel:416-555-1234'>416-555-1234</a><br /> <br /> Call at <a href='tel:416-555-1234'>our number</a> <br /> <br /> <a href='416-555-1234'>Blah</a> <br /> <br /> For more info, call <b>416-555-1234</b> 

The first, surrounded by a link and printing a phone number, worked great. He pulled out a dialed hyphen and that's it. The second, saying our number with reference, worked exactly the same. This means that using <a href='tel:xxx-xxx-xxxx'> should work in all directions, but I would not suggest making my one test final.

A direct link to the number made expected: I tried to pull a nonexistent file from the server.

The latter did, as I mentioned above, and stopped the dialer, but without beautiful hyphens.

+19
May 05 '10 at
source share



All Articles