3

I want to call android application from JavaScript.

Akshata
  • 271
  • 2
  • 7
  • 11

1 Answers1

5

Actually, you can call applications that support URI Scheme data Intents such as:

document.location = "tel://0123456789"; // Open Dial App
document.location = "sms://0123456789"; // open SMS APp
document.location = "market://search?q=yoursearch";
document.location = "content://a_file"
document.location = "geo:0,0?q=your+street+address";
document.location = "content://call_log/calls/0"; // must have READ_CONTACTS perm
document.location = "content://calendar/events"; // must have READ_CALENDAR perm

All content providers should be accessible that way, but the application you are sending the Intent from (probably the Browser) must have the right permissions.

http://developer.android.com/guide/appendix/g-app-intents.html

Adarsh Madrecha
  • 2,897
  • 9
  • 45
  • 79
Rorist
  • 770
  • 7
  • 9
  • Thanks for replay..I am trying to open one application by clicking button: I am calling one JavaScript function which will call document.location = "/data/app/com.android.app1.apk"; In manifest file of app1.apk I am using following code But the application is not opening..... Do have any idea why it is not opening?? – Akshata May 12 '10 at 11:14
  • Again, you need to use URI scheme: document.location = "file:///sdcard/yourfile"; // It sends an android.intent.action.SEARCH with the file as data. But if you do so from the default browser, you won't have permission to load local resource. Permissions are from the intent sender perspective, here it's the Browser's permission that counts first! I strongly recommend you to read about how Android Intent system works ;-) – Rorist May 12 '10 at 12:36