You can use PackageManager
class to obtain ApplicationInfo
:
final PackageManager pm = getApplicationContext().getPackageManager();
ApplicationInfo ai;
try {
ai = pm.getApplicationInfo( this.getPackageName(), 0);
} catch (final NameNotFoundException e) {
ai = null;
}
final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
This would return the application name as defined in <application>
tag of its manifest.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…