Question

Let me clear what I mean. I’ve published on marketplace the app in version 1.0. Now I want to update my app to version 1.1. I wrote a method which should be called only when the app is updated from 1.0 to 1.1. When new users will already install the app in version 1.1 from marketplace a method should not be called.

Any suggestion?

EDIT:

I could solve my problem by getting date of app installation. Is there any way to obtain that kind of information in code?

Was it helpful?

Solution

You'll have to manage this yourself.

The simplest way to do this is to store (in IsolatedStorageSettings) the current app version number. You then check this when you start and compare it with the current apps version numebr.

If there isn't a value in settings then you know it's the first install.
If the version numbers are different you know the app was updated and you can take whatever action is appropriate as part of the upgrade. (Aside - I always think it's nice when apps acknowledge that they were upgraded.)

There's no way to get the datetime of installation but you could capture the date/time of first run. Just get (and save?) the date/time when storing the version number. Beware that you will be subject to changes in date/time on the device. If you want to use a webservice to get the date/time then you'll have to deal with issues of no connectivity.
I would recommend against trying to determine the version/upgrade based purely on the date/time on the device as there are many possible issues to consider and work around.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top