java - Android Install app dialog -


i have pretty simple question somehow not able find solution on stackoverflow.

i able start downloading of file webview , able listen broadcast after download completes. here relevant code

awebview.setdownloadlistener(new downloadlistener() {             public void ondownloadstart(string url, string useragent,                         string contentdisposition, string mimetype,                         long contentlength) { //              intent = new intent(intent.action_view); //              i.setdata(uri.parse(url)); //              startactivity(i);                  final string filename = urlutil.guessfilename(url,contentdisposition,mimetype);                          request request = new request(                             uri.parse(url));                     request.allowscanningbymediascanner();                     request.setnotificationvisibility(downloadmanager.request.visibility_visible_notify_completed);                     request.setdestinationinexternalpublicdir(environment.directory_downloads, filename);                      downloadmanager dm = (downloadmanager) getsystemservice(download_service);                     dm.enqueue(request);               }         }); 

now need know is, way can popup app install/cancel dialog programmatically particular downloaded app ?

you can try this:

string filepath = "your file path"; intent intent = new intent(intent.action_view); intent.setdataandtype(uri.fromfile(new file(filepath)),"application/vnd.android.package-archive"); startactivity(intent); 

the situation special use .apk file downloaded app?


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -