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; }
public check_result getCheckResult() { MtkAgpsProfileManager profileMgr = new MtkAgpsProfileManager(); profileMgr.updateAgpsProfile("/etc/agps_profiles_conf.xml"); MtkAgpsManager agpsMgr = (MtkAgpsManager) getContext().getSystemService(Context.MTK_AGPS_SERVICE); if (agpsMgr == null) { return check_result.UNKNOWN; } MtkAgpsConfig config = agpsMgr.getConfig(); if (1 != config.niEnable || 1 != config.supl2file) { return check_result.WRONG; } MtkAgpsProfile profile = agpsMgr.getProfile(); if (profile.addr.equalsIgnoreCase("218.206.176.50") && profile.port == 7275 && profile.tls == 1) { return check_result.RIGHT; } else { return check_result.WRONG; } }