这是开发人员文档:
http://developer.android.com/reference/android/content/pm/PackageManager.html
公共抽象字符串 [] currentToCanonicalPackageNames (字符串 [] 名称)
Added in API level 8
Map from the current package names in use on the device to whatever the current canonical name of that package is.
Parameters
names Array of current names to be mapped.
Returns
Returns an array of the same size as the original, containing the canonical name for each package.
公共抽象 String[] canonicalToCurrentPackageNames (String[] 名称)
Added in API level 8
Map from a packages canonical name to the current name in use on the device.
Parameters
names Array of new names to be mapped.
Returns
Returns an array of the same size as the original, containing the current name for each package.
查看源的此链接以获得更好的理解:
https ://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/app/ApplicationPackageManager.java
请参考这个 StackOverflow 问题:如何在 Android 中获取默认应用程序包的规范名称