[英]How to check programmatically if an application is installed or not in Android?
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
Guide Me.引导我。 I have no idea.我不知道。 Thanks.谢谢。
We have installed applications programmatically.我们已经以编程方式安装了应用程序。
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 steps在Kotlin中,最简单的方法可以是两步
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.