Reputation: 994
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.
Upvotes: 0
Views: 604
Reputation: 1
I don't think Shared Preferences can solve this problem as if user can Clear Data from
Settings> applications> Manage application>
all data will be lost. Other solutions are needed.
Upvotes: 0
Reputation: 8224
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
Upvotes: 0
Reputation: 5068
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
.
Upvotes: 1