'What is the Different between getting the PackageManger info through getPackageManager().getPackageInfo() and PackageManger Object?
What is the main different between getting the Packagemanger information via, getPackageManager() and PackageManager packageManager = context.getPackageManager(); ?,
above android sdk>=29, in order to get the PackageInfo, we should have to add the queries in the manifest like below, otherwise we can't get the PackageInfo,
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent>
</queries>
but what I observed one behavior in android-11 device(sdk-30), after I remove the queries from the manifest also, i can able to get the version for below code, what is that?
String version=this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
So, what I'm asking is, What is the different between 2 scenarios?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
