6

So, I want to check while user is installing the app from play store whether it was previously installed on his device or not? If he uninstalls the app and after few days reinstalls then how would I know that?

The reason I want a way to handle this case is that I just want to make certain features available when it is the very first install of the app.

  • Check a shared preference value on start, if it doesn't exist that means it's the first time user has installed and run the app .. to check if user had installed previously and uninstalled, I don't know it you can check that particular case – ShadowGod Sep 27 '16 at 21:42
  • but can't a user clear sharedpreferences? – Daniel Rust Sep 27 '16 at 21:43
  • @ShadowGod I have seen many working examples of second part that's why I know it's possible somehow. I just couldn't figure out how. – Sahil Sharma Sep 27 '16 at 21:44
  • also the shared pref will be cleared once the app is uninstalled. It will only be useful if you wanna check it's first run. I think so. – Sahil Sharma Sep 27 '16 at 21:47
  • See: http://stackoverflow.com/questions/9726990/keep-files-after-uninstallation-of-android-app – Morrison Chang Sep 27 '16 at 22:26

2 Answers2

2

You can store user's device id in server. So when user opens the application you have to ping your server with the device id to verify if the user already used this application in this mobile. If User installed, then you will be having the device id on server, otherwise you wont have the device id on server, now save the device id on server.

Sujith Niraikulathan
  • 2,111
  • 18
  • 21
  • What process do you use to get the device id? Through the TelephonyManager -> getSystemService -> ANDROID_ID method? – Daniel Rust Sep 27 '16 at 22:16
  • Please can you tell me more about this approach and also discuss a little about merits and demerits. Do you mean IMEI number ? – Sahil Sharma Sep 27 '16 at 22:22
  • 1
    @RustWebDev yes, you can fetch the device IMEI number and use that for device verification. SahilSharma It is like storing the login data in shared preferances. When the device opens the application, ask internet and check if the device imei is in your server, if not that means this is a new device using your application, so make the server to give response to respond back to your application to enable special features. If you already have the device imei on your server, then the device already used your application, so give server response to disable special features. – Sujith Niraikulathan Sep 27 '16 at 23:11
  • But will that solution work with tablets and other nontelephony devices? – Daniel Rust Sep 27 '16 at 23:14
  • And isn't IMEI hardware specific? What if the user changes devices? – Daniel Rust Sep 27 '16 at 23:15
  • 1
    If it user specific checkup, then instead of using device id, you have to store some user specific id. Since this question is about device specific installations, the checking hardware based id is better. I will check the unique id for nonTelephony devices – Sujith Niraikulathan Sep 27 '16 at 23:18
  • 1
    You can try getting the device wifi MAC id also if no sim slots for imei is available. – Sujith Niraikulathan Sep 27 '16 at 23:24
1

A few months ago, I came across an interview with Ryan Harter and Kaushik from the Fragmented Podcast regarding this issue. Ryan mentioned this exact scenario as something he desired from Android/GooglePlayStore but simply was not available.

The question is at the 31:49 mark. https://spec.fm/podcasts/fragmented/38519

Daniel Rust
  • 539
  • 1
  • 4
  • 15
  • Hey, Thank you so much for sharing this. I heard it. But he says more about **purchase tracking** right ? . I am more into **install tracking**. I am finding it bit hard to relate both. Maybe you could explain a little more as to how both things are connected. – Sahil Sharma Sep 27 '16 at 22:18
  • Given the context of the interview, he was using both "purchase tracking" and "install tracking" interchangeably. Around the same time as hearing this episode, I came across this [blogpost](http://android-developers.blogspot.com/2011/03/identifying-app-installations.html) (written in 2011) that shed more light into the pros and cons of "installation tracking" issue. This [SO post](http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id) also helped educate me on the topic, but be sure to read all the answers. – Daniel Rust Sep 27 '16 at 22:32