Way to know if my application is installed

前端 未结 2 1957
抹茶落季
抹茶落季 2021-01-16 20:43

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

Andro

相关标签:
2条回答
  • 2021-01-16 21:19

    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).

    0 讨论(0)
  • 2021-01-16 21:28

    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.

    0 讨论(0)
提交回复
热议问题