• 获取manifest中参数信息的方法


    /**获取AppKey*/
    public String getMetaValue() {
    Bundle metaData = null;
    String apiKey = null;
    try {
    ApplicationInfo ai =getPackageManager().getApplicationInfo(
    getPackageName(), PackageManager.GET_META_DATA);
    if (null != ai) {
    metaData = ai.metaData;
    }
    if (null != metaData) {
    //api_key 字符串要跟manifest配置文件里定义key对应
    apiKey = metaData.getString("api_key");
    }
    } catch (NameNotFoundException e) {

    }
    return apiKey;
    }

    、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

    <application>

    <meta-data android:name="api_key" android:value="DOkP8ZRiuIdrjpdE6Ssmlhpk" />
    </application>

  • 相关阅读:
    IEnumerator & IEnumerable
    GameObject.Active
    Unity3D的四种坐标系
    gvim
    Platform Dependent Compilation
    delegate
    new 约束
    UIPanel
    UIButton
    UISprite
  • 原文地址:https://www.cnblogs.com/clarence/p/3558013.html
Copyright © 2020-2023  润新知