views:

21

answers:

1

Hi, Im trying to display versionname using below code

PackageManager pkm = getPackageManager(); PackageInfo pki = pkm.getPackageInfo("com.example",PackageManager.GET_CONFIGURATIONS);

String tempCurrentVersion = pki.versionName;

Bt im getting exception at PackageManager.GET_CONFIGURATIONS as Name not found exception

Please tell me how i can solve this issue.

Thanks

A: 

I use this is my app and it works correctly.

String mVersion = this.getPackageManager().getPackageInfo(
    "com.safeneighborhood", 0).versionName;

If that doesn't work make sure your package name is correct. There aren't any special permissions for this.

BrennaSoft