Hi,

I am quite a newbie to Android, so chances are there is an easier way
to do this, but what I propose should work.
Have a look at this project from Android's SVN:
http://apps-for-android.googlecode.com/svn/trunk/Samples/WebViewDemo
It displays how to use a web view (if you want: a browser view that
you can integrate in your own application) and how to call JavaScript
from the activity that embeds it. Furthermore it shows how to call
from JavaScript into your Activity by registering a JavaScript
interface with the web view to serve as the callback. You could attach
JavaScript code to the link you want the user to press in your web
view, then that JavaScript code could call into your application and
that could initiate the call.

Say you had written a JavaScript interface class like this:

public class CallDispatcher{

  public void call(String number)
  {
     String dispatchURI = "tel:" + number;
     // the code to fire the intent to start the call
  }
}

then in the activity you embed the WebView in you would call:

mWebView.addJavascriptInterface(new CallDispatcher(),
"jsCallDispatcher");

and in the JavaScript of the link you would call:

window.jsCallDispatcher.call("+00161384950");


I think that should work.

Cheers,

nle



On 3 Jun., 11:33, dev_rob <[email protected]> wrote:
> Hi,
>
> is it possible to start a call from the android browser, let's say by
> clicking a link in an html file or with javascript after a button
> click? maybe with help of the gears api?
>
> i'd appreciate any hints, maybe an example of how to embed the intent
> in the html-file/in javascript.
>
> thanks a lot!!
> cheers

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to