I want to call android application from JavaScript.
Asked
Active
Viewed 6,767 times
1 Answers
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
- 6,364
- 11
- 69
- 117

Rorist
- 810
- 8
- 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
-
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