Is there a work around to check if the android app installed in the same device for the second time as well as the first installation date .Does Google Play Services
provides api to fetch details pertaining to apps installation and uninstallation.

- 994
- 7
- 15
-
http://stackoverflow.com/questions/5311644/get-application-installed-date-on-android have a look at it – Usman Kurd Mar 27 '14 at 07:13
-
@UsmanKurd I tried this method before it gives the `firstInstallTime` of the current installation.Though the app was previously installed and removed. – kaar3k Mar 27 '14 at 07:15
-
save some file on the device – user1940676 Mar 27 '14 at 07:25
3 Answers
you can create your own server and when app installed on mobile, get the IMEI
code and send to the server and store it in database
. if the user again installed that app and when you get IMEI
code on server compare and check whether IMEI
exist or not . if exist he is installing again else he is installing for the very first time
.

- 5,005
- 2
- 23
- 45
-
I am looking for a method which doesn't involve having a server.Any idea `google play services` provides a `api` to achieve this. – kaar3k Mar 27 '14 at 07:19
-
You can just store IMEI in the preferences. In OnCreate of main activity check it, if there is no - first start. – Alex Kucherenko Mar 27 '14 at 07:50
I didn't hear about such Play Services
possabilities. But you can do it like @wqrahd told you or just, with out server
part, create file on your external storage.
And to check if you are installing or updating application use SharedPreferences. They will not be removed after Application update so you can create some migration scheme and check it, like this :
public class MigrationManager {
private final static String KEY_PREFERENCES_VERSION = "key_preferences_version";
private final static int PREFERENCES_VERSION = 2;
public static void migrate(Context context) {
SharedPreferences preferences = context.getSharedPreferences("pref", Context.MODE_PRIVATE);
checkPreferences(preferences);
}
private static void checkPreferences(SharedPreferences thePreferences) {
final double oldVersion = thePreferences.getInt(KEY_PREFERENCES_VERSION, 1);
if (oldVersion < PREFERENCES_VERSION) {
final SharedPreferences.Editor edit = thePreferences.edit();
edit.clear();
edit.putInt(KEY_PREFERENCES_VERSION, currentVersion);
edit.commit();
}
}
}
I wrote an article about Preferences where migration scheme is described. Cheers

- 8,174
- 3
- 31
- 35