核心代码
```
for (packageInfo in packageManager.getInstalledPackages(PackageManager.GET_RECEIVERS)) {
if (packageInfo.receivers != null) {
for (receiverInfo in packageInfo.receivers) {
if (
receiverInfo.name == "com.google.firebase.iid.FirebaseInstanceIdReceiver" ||
receiverInfo.name == "com.google.android.gms.measurement.AppMeasurementReceiver") {
val appName = packageInfo.applicationInfo.loadLabel(packageManager).toString()
val packageName = packageInfo.packageName
var icon:Drawable? = packageInfo.applicationInfo.loadIcon(packageManager);
val appInfo = AppInfo(appName, packageName, icon)
appList.add(appInfo)
break
}
}
}
}
```