android - How control the "accept" or "cancel" buttons when installing an APK programmatically? -


i have function auto-updating app (it's non-market app) , want control "ok" or "cancel" button when decide accept update or decline update.

here code (the code works doesn't control buttons)

public void update(string apkurl,string versio){     try {           url url = new url(apkurl);           httpurlconnection c = (httpurlconnection) url.openconnection();           c.setrequestmethod("get");           c.setdooutput(true);           c.connect();            string path = environment.getexternalstoragedirectory() + "/download/";           file file = new file(path);           file.mkdirs();           file outputfile = new file(file, "app.apk");           outputfile.delete();           fileoutputstream fos = new fileoutputstream(outputfile);            inputstream = c.getinputstream();            byte[] buffer = new byte[1024];           int len1 = 0;           while ((len1 = is.read(buffer)) != -1) {               fos.write(buffer, 0, len1);           }           fos.close();           is.close();//till here, works fine - .apk download sdcard in download file            intent intent = new intent(intent.action_view);           intent.setdataandtype(uri.fromfile(new file(environment.getexternalstoragedirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive");           startactivity(intent);           } catch (ioexception e) {           toast.maketext(getapplicationcontext(), "update error!", toast.length_long).show();       } } 


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -