这行文字在开发者网站上有说明,但我并没有完全理解它的意思。
Call getInstalledApplications() or getInstalledPackages(). Both methods should return a filtered list.
实际上,我需要测试测试包可见性行为
https://developer.android.com/training/package-visibility/testing
这行文字在开发者网站上有说明,但我并没有完全理解它的意思。
Call getInstalledApplications() or getInstalledPackages(). Both methods should return a filtered list.
实际上,我需要测试测试包可见性行为
https://developer.android.com/training/package-visibility/testing
在Android 11中,有3种不同的查询用户已安装应用程序的方法。
AndroidManifest
中的<queries>
元素中提及包名称。<manifest package="com.nikit.app">
<queries>
<package android:name="com.fake.app" />
<package android:name="com.fake.game" />
</queries>
...
</manifest>
<queries>
元素内使用意图过滤器,根据你的需求进行设置,就像下面的代码片段中所示。<manifest package="com.nikit.app">
<queries>
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="image/jpeg" />
</intent>
</queries>
...
</manifest>
<intent>
元素看起来像 <intent-filter>
, 但有一些不同之处。该元素有以下限制:
<intent>
元素只能有一个 <action>
元素。<intent>
元素只能具有以下属性:mimeType
、scheme
和 host
。AndroidManifest
中包含 QUERY_ALL_PACKAGES
权限。它是一个 normal
权限,当应用安装后立即授予该权限。<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
com.example.*
的东西。 - Rohit