import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; public class UmUtils { /** * 得到友盟的渠道号 */ public static String getUmMetaInfo(Context context) { try { ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = ai.metaData; return bundle.getString("UMENG_CHANNEL"); } catch (NameNotFoundException e) { e.printStackTrace(); return ""; } } }
时间: 2024-10-27 05:38:05