getAppInfo

fun getAppInfo(context: Context): String

Returns the version name of the application as defined in the manifest.

Uses android.content.pm.PackageManager.getPackageInfo to retrieve package metadata. Falls back to an empty string if android.content.pm.PackageInfo.versionName is null.

Return

A String representing the version name (e.g., "1.0.0"), or an empty string if unavailable.

Parameters

context

The Context used to access the package manager.