/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.mozstumbler.client;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import org.mozilla.mozstumbler.BuildConfig;
public final class PackageUtils {
private PackageUtils() {
}
public static String getAppVersion(Context context) {
PackageManager pm = context.getPackageManager();
try {
return pm.getPackageInfo(BuildConfig.APPLICATION_ID, 0).versionName;
} catch (NameNotFoundException e) {
throw new IllegalArgumentException(e);
}
}
}