@@ -0,0 +1,2195 @@
+package com.growth.util;%0A%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.content.pm.PackageInfo;%0Aimport android.content.pm.PackageManager;%0Aimport android.content.pm.PackageManager.NameNotFoundException;%0Aimport android.net.Uri;%0Aimport java.io.File;%0A%0Apublic class AppUtil %7B%0A    private static final String TAG = AppUtil.class.getSimpleName();%0A%0A    /**%0A     * %E8%8E%B7%E5%8F%96%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E5%90%8D%E7%A7%B0%0A     */%0A    public static String getAppName(Context context) %7B%0A        try %7B%0A            PackageManager packageManager = context.getPackageManager();%0A            PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);%0A            int labelRes = packageInfo.applicationInfo.labelRes;%0A            return context.getResources().getString(labelRes);%0A        %7D catch (NameNotFoundException e) %7B%0A            e.printStackTrace();%0A        %7D%0A        return null;%0A    %7D%0A%0A    /**%0A     * %5B%E8%8E%B7%E5%8F%96%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%89%88%E6%9C%AC%E5%90%8D%E7%A7%B0%E4%BF%A1%E6%81%AF%5D%3CBR%3E%0A     *%0A     * @return %E5%BD%93%E5%89%8D%E5%BA%94%E7%94%A8%E7%9A%84%E7%89%88%E6%9C%AC%E5%90%8D%E7%A7%B0%0A     */%0A    public static String getVersionName(Context context) %7B%0A        try %7B%0A            PackageManager packageManager = context.getPackageManager();%0A            PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);%0A            return packageInfo.versionName;%0A%0A        %7D catch (NameNotFoundException e) %7B%0A        %7D%0A        return null;%0A    %7D%0A%0A    /**%0A     * @return %E5%BD%93%E5%89%8D%E7%A8%8B%E5%BA%8F%E7%9A%84%E7%89%88%E6%9C%AC%E5%8F%B7%0A     */%0A    public static int getVersionCode(Context context) %7B%0A        int version;%0A        try %7B%0A            PackageManager pm = context.getPackageManager();%0A            PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);%0A            version = packageInfo.versionCode;%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A            version = 0;%0A        %7D%0A        return version;%0A    %7D%0A%0A    /**%0A     * %E5%BE%97%E5%88%B0%E5%AE%89%E8%A3%85%E7%9A%84intent%0A     */%0A    public static Intent getInstallIntent(File apkFile) %7B%0A        Intent intent = new Intent();%0A        intent.setAction(Intent.ACTION_VIEW);%0A        intent.setDataAndType(Uri.fromFile(new File(apkFile.getAbsolutePath())),%0A                %22application/vnd.android.package-archive%22);%0A        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);%0A        return intent;%0A    %7D%0A%0A%7D%0A

add app util