| | |
| | | import android.content.Context; |
| | | import android.content.pm.ApplicationInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import java.util.Iterator; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2018/7/26. |
| | | */ |
| | | |
| | | public class ManifestDataUtil { |
| | | private static final String TAG ="ManifestDataUtil" ; |
| | | |
| | | /** |
| | | * 获取application中指定的meta-data。本例中,调用方法时key就是UMENG_CHANNEL |
| | | * |
| | | * @return 如果没有获取成功(没有对应值,或者异常),则返回值为空 |
| | | * @return 如果没有获取成功(没有对应值 , 或者异常),则返回值为空 |
| | | */ |
| | | public static String getAppMetaData(Context ctx, String key) { |
| | | if (ctx == null || TextUtils.isEmpty(key)) { |
| | |
| | | resultData = applicationInfo.metaData.getString(key); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } catch (PackageManager.NameNotFoundException e) { |
| | | e.printStackTrace(); |