Android 13 (SDK 33): PackageManager.getPackageInfo(String, int) deprecated. what is the alternative?
If you are using Kotlin, you can add extension function to your project: fun PackageManager.getPackageInfoCompat(packageName: String, flags: Int = 0): PackageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong())) } else { @Suppress(“DEPRECATION”) getPackageInfo(packageName, flags) } and after just call packageManager.getPackageInfoCompat(packageName) or add another flag, if you need.