简体   繁体   English

即使已将android应用程序从设备中删除,如何检查是否已安装

[英]How to check if an android application was installed even if it is removed from the device

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 有没有一种方法可以检查是否通过另一个Android应用程序在设备中安装了Android应用程序,即使用户已将其从其Android设备中删除

For eg:- Let us suppose a user has installed android app A and removed it from his/her device. 例如:-让我们假设一个用户已经安装了android app A并将其从他/她的设备中删除。 Now I have installed an Android app B.Is there a way to check through application B, if the user had installed app A 现在我已经安装了Android应用B,如果用户已经安装了应用A,有没有办法检查应用B

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;
    }
}

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) 在这里,您需要使用应用程序包名称(您想知道的应用程序)调用该方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android设备中使用googlePlay检查已安装的应用程序 - How to check installed application using googlePlay or not in android device 如何获取Android应用程序尝试从设备中删除/卸载的操作 - How to get action that android application is trying removed/uninstalled from device Titanium:检查设备上是否安装了应用程序(android) - Titanium: Check if application installed on the device (android) 如何查看 android 设备中是否安装了 Whatsapp? - How to check Whatsapp is installed in device in android? 如何检查 Android 设备上安装的 Fonts - How to check Installed Fonts on Android Device 检查是否安装了应用程序 - Android - Check if application is installed - Android 如何检查应用程序是否已从android / iphone设备上卸载 - How to check if application is uninstalled from android/ Iphone device 如何以编程方式检查 Android 中是否安装了应用程序? - How to check programmatically if an application is installed or not in Android? Android获取有关安装或删除的应用程序的广播 - Android get broadcast about the application installed or removed 如何从web检查如果在设备上安装了apk的apk的versionName在Android Studio中是否相同 - How to check from a web if the versionName of apk with the installed apk at device it is the same or not in Android Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM