简体   繁体   English

如何以编程方式检查 Android 中是否安装了应用程序?

[英]How to check programmatically if an application is installed or not in Android?

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果该应用程序已安装在设备中,则该应用程序会自动打开。
  2. Otherwise install the particular application.否则安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

We have installed applications programmatically.我们已经以编程方式安装了应用程序。

  1. If the application is already installed in the device the application is open automatically.如果应用程序已经安装在设备中,则该应用程序将自动打开。
  2. Otherwise install the particular application.否则,请安装特定的应用程序。

Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。

Android 11 update安卓 11 更新
You have to specofy in the manifest the exact bundle id's you want to search for.您必须在清单中指定要搜索的确切捆绑包 ID。

Example for facebook and whatsapp: facebook 和 whatsapp 的示例:

Inside the Manifest above "application" (where the permissions are)在“应用程序”上方的清单内(权限所在)

<queries>
    <package android:name="com.whatsapp" />
    <package android:name="com.facebook.katana" />
</queries>  

This will allow you to check if facebook and whatsapp are installed, otherwise you will always get false for that check.这将允许您检查是否安装了 facebook 和 whatsapp,否则您将始终得到错误的检查。

Further reading on the subject:关于该主题的进一步阅读:
https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9 https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9

In Kotlin , the simplest way can be two stepsKotlin中,最简单的方法可以是两步

1- in the Manifest put the target app id . 1- 在 Manifest 中放置目标应用程序 ID ex (com.src.turkey) ex (com.src.turkey)

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <queries>
        <package android:name="com.src.turkey" />
               </queries>
...

2- In an Activity 2- 在活动中

 try {

 val list = packageManager.getLaunchIntentForPackage("com.src.turkey")
        if (list != null) {
            Log.i("TAG", "downloadApps:$list")
        }

    } catch (e: PackageManager.NameNotFoundException) {
        Log.i("TAG", "downloadApps: False")
    }

There isn't any deprecated such as没有任何弃用的,例如

queryIntentActivities

pm.getPackageInfo

暂无
暂无

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

相关问题 检查是否安装了应用程序 - Android - Check if application is installed - Android 如何以编程方式检查 package 是否安装在 android Kotlin 中以用于 ZC31B32364CE19CA8FCD12CE+4? - How to check if a package is installed in android Kotlin programmatically for android 12+? 在 Android 如何以编程方式检查手机中是否安装了应用程序 android 11 - In Android how to check app is installed in your phone or not android 11 programmatically 如何查看是否以编程方式在Android上安装了Tencent(Weibo)app? - How to check if Tencent(Weibo) app is installed on Android or not programmatically? 如何检查QQ(腾讯)应用程序是否已在Android上以编程方式安装? - How to check if QQ(tencent) app is installed on Android or not programmatically? 如何在Android中以编程方式更新预安装的应用程序 - How to update the pre-installed application programmatically in android 如何学习以编程方式在Android中安装了哪个版本的应用程序 - How to learn which version of application installed programmatically in android 检查是否以编程方式安装了Android SDK包 - Check if Android SDK package is installed programmatically 即使已将android应用程序从设备中删除,如何检查是否已安装 - How to check if an android application was installed even if it is removed from the device 如何在Android设备中使用googlePlay检查已安装的应用程序 - How to check installed application using googlePlay or not in android device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM