Reputation: 1243
Is there any way (intent) to know if my application is installed ? I followed the below link, but my application don't get the intent when my app is installed
Android - How to intercept the 'Install application' intent
Upvotes: 0
Views: 5957
Reputation: 200080
If you want to execute any code from app A, it has to be already installed (it's obvious, isn't it?), so you can't check from your app A whether your app APP is installed or not.
It's like if you want to know when you are dead: after you die, it will be impossible to know it. On the other hand, someone else can know when you die... same for the Android scenario: an app B can know whether app A is installed or not (by using getInstalledPackages
or intents or whatever).
Upvotes: 4
Reputation: 11537
You can use http://developer.android.com/reference/android/content/pm/PackageManager.html#getInstalledPackages(int)
Remember to set the appropriate permission in your AndroidManifest.
You quoted the link to Android - How to intercept the 'Install application' intent - which would mean you like to know when you application was installed at all? Are you trying to check if people actually download your app? Basically I think it's not possible to do that.
But if you like to see if your app was installed, just check for a SharedPreference and if not possible, it's a fresh install.
Upvotes: 0