3

I want to call android application from JavaScript.

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

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 <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??
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 ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.