0

In my project I have a code that download a new version of the app hosted in dropbox.com for updating old version. After download is completed, app installion intent is called like below.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(baseDir+fileName)), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
mContext.startActivity(intent);

There is something I want to know is whether user do installation or not, if user install new version successfully, I have to save the version that the user installed in database. So I need to know the user did installation. Any suggestion is greatly appreciated.

Thanks in advance

NSA
  • 23
  • 4

2 Answers2

0

Only this is the suggestion:

Before the Intent for install the application is call just update the version number in your table. I guess here you can get the older version number of the application.

After the installation process complete you can get the latest version number of the application if you want to update the latest version number then do it after installation process complete.

Amsheer
  • 7,046
  • 8
  • 47
  • 81
  • Thank Amsheer, but I need a return or some callback method from intent of install the application. Upon the return value (value like as installation complete or cancel) I have to decide to update version of application in database. – NSA Dec 01 '14 at 10:48
-1

why dount you check the App Version when the user launches the Application and update the database when the version is different from the current?

Community
  • 1
  • 1
Sven M.
  • 59
  • 1
  • 5