UmUtils得到友盟的渠道号
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 ""; } } }
最后,关注【码上加油站】微信公众号后,有疑惑有问题想加油的小伙伴可以码上加入社群,让我们一起码上加油吧!!!