Esempio n. 1
0
  private boolean setSUPL(Context context) {
    MtkAgpsProfileManager profileMgr = new MtkAgpsProfileManager();
    profileMgr.updateAgpsProfile("/etc/agps_profiles_conf.xml");

    MtkAgpsManager agpsMgr = (MtkAgpsManager) context.getSystemService(Context.MTK_AGPS_SERVICE);

    if (agpsMgr == null) {
      return false;
    }

    // set net work request
    MtkAgpsConfig config = agpsMgr.getConfig();
    config.niEnable = 1;
    config.supl2file = 1;
    agpsMgr.setConfig(config);

    // look for cmcc lab profile
    for (MtkAgpsProfile profile : profileMgr.getAllProfile()) {
      if (profile.name.equalsIgnoreCase("Lab - CMCC")) {
        agpsMgr.setProfile(profile);
        return true;
      }
    }

    MtkAgpsProfile profile = agpsMgr.getProfile();
    profile.addr = "218.206.176.50";
    profile.port = 7275;
    profile.tls = 1;
    agpsMgr.setProfile(profile);

    return true;
  }