-3

Hi everyone i have a question about android programming :

If i have 2 apps in google play one of user download app (1), how i know if in user device have a app (2)

i wont if in user device have app(2) , the app(1) show Toast and say

"the app number (2) is install"
Or
"You have app number (2) thanks"

AMX
  • 1
  • 4
  • You shoult try this. https://stackoverflow.com/questions/3694267/android-check-for-presence-of-another-app – wetfoxx Jun 22 '17 at 22:41

1 Answers1

0

You can check like this,

    PackageManager localPackageManager = getPackageManager();

    // Main thing is it will return the launcher, If the app dont have launcher, use getPackageInfo(package, 0) will NameNotFoundException if no package
    Intent launchIntent = localPackageManager.getLaunchIntentForPackage("[Seconf app package name]");

    if (launchIntent != null) {
        // the app number (2) is install
    } else {
        // not installed.
    }
Muthukrishnan Rajendran
  • 11,122
  • 3
  • 31
  • 41