0

Is there a way to check whether an android application was installed in the device through another android app, even if the user has removed it from his/her android device

For eg:- Let us suppose a user has installed android app A and removed it from his/her device. Now I have installed an Android app B.Is there a way to check through application B, if the user had installed app A

  • 1
    yes you can get the list of apps installed in your device...and then from that list you can check for app A..if you any details of app A ...like pacakge name..etc – Meenal Jun 13 '16 at 05:30
  • http://stackoverflow.com/questions/11392183/how-to-check-programmatically-if-an-application-is-installed-or-not-in-android – Naveen Tamrakar Jun 13 '16 at 05:38
  • @MeenalSharma taking time to find apps Search Apps Using Package Name and check true or false – Naveen Tamrakar Jun 13 '16 at 05:39
  • There is no general way to determine if an app **that is not present on the device now** was previously present, however *some* apps may leave behind characteristic files for example on the External Storage, though those may be ambiguous and apps using only Internal Storage or the more modern auto-cleaned external methods would not do so. – Chris Stratton Jun 13 '16 at 05:40
  • **Do not bother trying to answer this** unless you pay attention to "even if it is removed from the device" in the question requirement. – Chris Stratton Jun 13 '16 at 05:41
  • No you cannot do that AFAIK. there will be no record of removed applications in the Android OS. – Murtaza Khursheed Hussain Jun 13 '16 at 06:14
  • Have you looked at PackageManager.GET_UNINSTALLED_PACKAGES? I'm not sure if it qualifies as an answer, but it might be worth checking out. – oiZo Jun 13 '16 at 06:27
  • its only when if they uninstalled with flag `DONT_DELETE_DATA`. It mean do not delete data folder from your device – Murtaza Khursheed Hussain Jun 13 '16 at 06:49

2 Answers2

-1
please try this method its return whether application is install or not but just you need to pass package name of your app.

private boolean isPackageInstalled(String packagename, Context context) {
    PackageManager pm = context.getPackageManager();
    try {
        pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
        return true;
    } catch (NameNotFoundException e) {
        return false;
    }
}
ViratBhavsar
  • 104
  • 4
-2

Try this...

final PackageManager packageManager = getPackageManager();
    List<ApplicationInfo> AppPackages = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);
    for (ApplicationInfo AppPackageInfo : AppPackages) {
        Log.d(TAG, "Installed App Package :" + AppPackageInfo.packageName);
        Log.d(TAG, "Launch Activity :" + packageManager.getLaunchIntentForPackage(AppPackageInfo.packageName));
    }

UPDATED

    private boolean isAppInstalled(String appPackage) {
    boolean isAppExists = false;
    PackageManager packageManager = getPackageManager();
    List<ApplicationInfo> AppPackages = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);
    for (ApplicationInfo appPackageInfo : AppPackages) {
        if (appPackageInfo.packageName.equalsIgnoreCase(appPackage)) {
            isAppExists = true;
            break;
        } else {
            isAppExists = false;
        }
    }
    return isAppExists;
}

Here you need to call the method with app package name(the app which you wants to know)

GvSharma
  • 2,632
  • 1
  • 24
  • 30
  • This answer is useless as it ignores "even if it is removed from the device" in the question requirement. – Chris Stratton Jun 13 '16 at 05:40
  • @chris Stratton.......how can assert your comment here? i have tested and verified that above code in my lollipop and marshmallow device. – GvSharma Jun 13 '16 at 05:55
  • 1
    The question specifically seeks a solution which will identify an app which had been installed, **but has been removed *before* the query is made**. Your code cannot accomplish that, so it is not an answer to the question asked. As I posted in my comment on the question itself, there is likely no general solution to this problem - ie, the only answer is "No, you cannot do that" – Chris Stratton Jun 13 '16 at 06:03
  • 1
    Still wrong - obviously you do not understand the question which is being asked. If you did understand it, you would soon realize that Android does not offer a way of doing this. – Chris Stratton Jun 13 '16 at 06:16