PackageManager
Class for retrieving various kinds of information related to the application packages that are currently installed on the device. You can find this class through
Context#getPackageManager
.PackageManager 负责管理应用程序安装、卸载和升级的API。
getLaunchIntentForPackage
abstract fun getLaunchIntentForPackage(packageName: String): Intent?
Returns a “good” intent to launch a front-door activity in a package. This is used, for example, to implement an “open” button when browsing through packages. The current implementation looks first for a main activity in the category
Intent#CATEGORY_INFO
, and next for a main activity in the categoryIntent#CATEGORY_LAUNCHER
. Returnsnull
if neither are found.负责获得应用程序Launch的Intent。
返回一个“包”中的入口Activity的Intent,例如,这个类似于在浏览包的“打开”按钮。这个当前的安装启动第一步在category(CATEGORY_INFO)中寻找main Activity,然后category(CATEGORY_LAUNCHER)寻找main Activity。如果找不到返回 null。