core-android/src/main/java/com/uber/sdk/android/core/utils/PackageManagers.java
@Nullable
    public static PackageInfo getPackageInfo(@NonNull Context context, @NonNull String packageName) {
        try {
            return context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA);
        } catch (PackageManager.NameNotFoundException e) {
            return null;
        }
    }
@Nullable
    public static PackageInfo getPackageInfo(@NonNull Context context, @NonNull String packageName) {
        try {
            return context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA);
        } catch (PackageManager.NameNotFoundException e) {
            return null;
        }
    }
@ Nullable public static PackageInfo getPackageInfo ( @ NonNull Context context , @ NonNull String packageName ) { try { return context . getPackageManager ( ) . getPackageInfo ( packageName , PackageManager . GET_META_DATA ) ; } catch ( PackageManager . NameNotFoundException e ) { return null ; } }
A safe method to obtain {@link PackageInfo} from {@link android.content.pm.PackageManager}
If package is not available, it would just return null.

@param context to be used for looking
@param packageName to look up against context
@return {@link PackageInfo} retrieved from Context.
A safe method to obtain { @link PackageInfo } from { @link android . content . pm . PackageManager } If package is not available it would just return null .