Android Question Detect Previous Installation

Jim McDougal

Member
Licensed User
Is there a way to detect a previous installation of an app? I'm developing a limited play version of an app with in-app purchase to buy, but I'd like to prevent users from simply uninstalling and downloading from the Play Store again for another round of free plays.
 

aeric

Expert
Licensed User
Longtime User
Is your app reset the in-app product when first run?
 
Upvote 0

Jim McDougal

Member
Licensed User
I'm describing the situation where the user never buys the in-app product to unlock the permanent version, but simply uninstalls and reinstalls the trial version to get another round of free plays. As I understand, when an app is uninstalled all the files related to the app are also removed.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
My idea is this:
- A user install your app for the 1st time.
- He/She is prompted with a screen that requires him/her to click a button to start using the app and it triggers the event to consume the in-app product.
- He/She uninstall the app.
- He/She install the app again.
- The app starts but check that the in-app product is already consumed.
- He/She cannot proceed to use the app.

Note: The in-app product doesn't require the user to purchase. It is available to him/her by default.
 
Upvote 0

Jim McDougal

Member
Licensed User
So, I could have one (free) in-app product to simply monitor previous installation and another (purchase) to actually buy and unlock the permanent version?
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
2- request PERMISSION_WRITE_EXTERNAL_STORAGE and write a very simple txt that contains the installation datetime, once the client install the app check for this file and see if it exists and if it does then read it's contents and check when it was last installed.
That won't work because minimum target API is 31 for new apps & 30 for existing ones & WRITE_EXTERNAL_STORAGE has no effect on apps targeting API 30 & above. You can try using the MANAGE_EXTERNAL_STORAGE, but unless the app is a file manager it's unlikely you'll get it on the allowlist.

https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE

- Colin.
 
Upvote 0
Top