android - Programmatically installing APK. What activity is needed in the APK being installed? -



android - Programmatically installing APK. What activity is needed in the APK being installed? -

i'm trying install apk within app. have seen examples out there show intent use. along these lines:

uri apkurl = uri.parse(environment.getexternalstoragedirectory() + "/download/" + "test.apk"); intent promptinstall = new intent(intent.action_view).setdataandtype(apkurl, "application/vnd.android.package-archive"); startactivity(promptinstall);

when run though exception:

android.content.activitynotfoundexception: no activity found handle intent { act=android.intent.action.view dat=/storage/emulated/0/download/test.apk typ=application/vnd.android.package-archive }

i'm new android. guess means test.apk needs activity in it's manifest xml action_view intent. i'm not sure how write or if needs activity associated in source files? or requirements apk installed?

thanks! kyle

the error indicates android cannot find installed activity can handle request view given uri. has nil code within apk.

your problem uri has no scheme, isn't formatted. uri should this:

`file:///storage/emulated/0/download/test.apk`

to prepare can this:

file apkfile = new file(environment.getexternalstoragedirectory() + "/download/" + "test.apk"); uri apkurl = uri.fromfile(apkfile);

android android-intent

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -