元数据Meta Data

<meta-data
            android:name="ChannelID"
            android:value="GOAPK Market" />
  
private void getMetaData(){
        try {
            final PackageManager pm = context.getPackageManager();
            ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA);
            final String billingChannel = ai.metaData.getString("ChannelID");
                   } catch (NameNotFoundException e) {
            e.printStackTrace();
            Log.e("Constants.Tag", "can not get channelID");
        }
    }
   

相关推荐