tags:

views:

205

answers:

2

I want to call android application from JavaScript.

A: 

well.. sorry but you can't.

optimystery
ok fine....Lets see
Akshata
A: 

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

document.location = "tel://0123456789";
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

Rorist
Thanks for replay..I am trying to open one application by clicking button: I am calling one JavaScript function which will calldocument.location = "/data/app/com.android.app1.apk";In manifest file of app1.apk I am using following code<intent-filter><action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.BROWSABLE"/></intent-filter>But the application is not opening.....Do have any idea why it is not opening??
Akshata
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