James Coote
James Coote

Reputation: 1973

Install app from android browser

I created an app that installs another app from an apk file on the sd card:

File fullPath = new File(Environment.getExternalStorageDirectory() + "/test_intent_target.apk");

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(fullPath);
intent.setDataAndType(uri, "application/vnd.android.package-archive");

startActivity(intent);

I then used log to get the intent as a string:

Log.d("my intent", intent.toUri(Intent.URI_INTENT_SCHEME));

which produces:

intent:///mnt/sdcard/test_intent_target.apk#Intent;scheme=file;action=android.intent.action.VIEW;type=application/vnd.android.package-archive;end

I now want to create a link in a web browser that launches that intent. I've tried:

<a href="intent:///mnt/sdcard/test_intent_target.apk#Intent;scheme=file;action=android.intent.action.VIEW;type=application/vnd.android.package-archive;end">Install App</a>

but the web browser just comes back with page not available. I keep seeing examples of people using <a href="intent:#Intent;etc;etc;end> but it doesn't seem to work for me, and I'm not sure what I'm doing wrong. Any help or clues here would be appreciated

Thanks,

James

Upvotes: 0

Views: 591

Answers (1)

Gilead
Gilead

Reputation: 1526

<a href="file:///mnt/sdcard/...."> Also, not sure if you need the part after .apk.

Upvotes: 1

Related Questions