How do I avoid multiple apk install promps on an Android programmatic install? -


our android applications automatically check updates every 5 minutes in background , downloads latest .apk file our downloads server.

it fires off install using below method:

public static void installdownloadedapplication(context context) {     intent intent = new intent(intent.action_view);     intent.addflags(intent.flag_activity_new_task);     file sdcard = environment.getexternalstoragedirectory();     file file = new file(sdcard, constants.application_code+".apk");     uri uri = uri.fromfile(file);     intent.setdataandtype(uri, "application/vnd.android.package-archive");     context.startactivity(intent); } 

this prompts end-user (using standard android os application install prompt) install or cancel application apk.

if 1 of our applications in need of update, android install prompt appears once no matter how many times above code in 1 application runs.

the problem having if user leaves android device long while , multiple of applications need auto update @ same time, code run every 5 minutes each application, multiple android install prompts appear second application tries install.

example 1: application x gets update, user leaves 15 mins, , 1 install prompt application x appears.

example 2: both application x , y update, user leaves 15 mins, , 1 install prompts appear application x 3 install prompts appear application y

any ideas causing problem in example 2?

thanks

your server tells latest apk. compare 1 in download area. if have downloaded latest version, don't need download again.

also, when start install via intent, remember writing version id , date/time shared preferences. don't try install same version again until x hours/days have passed.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -