コード例 #1
0
  private int readFromLocal(String accPath) {
    // isAlreadyReadLocal = true;
    String path = accPath + LOCAL_CONFIG_FILENAME;
    if (!FileOperation.fileExists(path)) {

      readConfig();
      return -1;
    }
    byte[] buf = FileOperation.readFromFileV2(path, 0, -1);
    if (Util.isNullOrNil(buf)) {

      readConfig();
      return -2;
    }
    String info = new String(buf);
    if (Util.isNullOrNil(info)) {

      readConfig();
      return -3;
    }
    Log.d(TAG, "readFromLocal info " + info);
    cfgStg.set(ConstantsStorage.USERINFO_SERVER_CONFIG_INFO, info);
    isAlreadyReadLocal = true;

    super.doNotify(info);
    return 0;
  }
コード例 #2
0
  private void readConfig() {

    String info = (String) cfgStg.get(ConstantsStorage.USERINFO_SERVER_CONFIG_INFO);
    Log.d(TAG, "readConfig xml " + info);
    if (!Util.isNullOrNil(infoCache)) {
      super.doNotify(info);
    }
  }
コード例 #3
0
  public static boolean writeConfigToFile(String info) {

    if (Util.isNullOrNil(info)) {

      return false;
    }
    try {
      Map<String, String> maps = KVConfig.parseXml(info, "voip", null);

      if (maps == null) {
        return false;
      }
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }

    boolean flag = false;
    File filePath = new File(ConstantsStorage.DATAROOT_MOBILEMEM_PATH);
    if (!filePath.exists()) {
      filePath.mkdirs();
    }
    FileWriter fw = null;
    try {
      fw = new FileWriter(ConstantsStorage.DATAROOT_MOBILEMEM_PATH + LOCAL_CONFIG_FILENAME);
      fw.write(info);
      flag = true;
      if (fw != null) {
        fw.close();
      }

    } catch (Exception e) {
      e.printStackTrace();

    } finally {
      if (fw != null)
        try {
          fw.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
    }

    return flag;
  }
コード例 #4
0
 public static String getLocalFingerprint() {
   LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
   String flinger = android.os.Build.FINGERPRINT;
   if (flinger != null) {
     flinger = flinger.replace("/", ":");
   }
   map.put("fingerprint", flinger);
   map.put("manufacturer", android.os.Build.MANUFACTURER);
   map.put("device", android.os.Build.DEVICE);
   map.put("model", android.os.Build.MODEL);
   map.put("product", android.os.Build.PRODUCT);
   map.put("board", android.os.Build.BOARD);
   map.put("release", android.os.Build.VERSION.RELEASE);
   map.put("codename", android.os.Build.VERSION.CODENAME);
   map.put("incremental", android.os.Build.VERSION.INCREMENTAL);
   map.put("display", android.os.Build.DISPLAY);
   String key = Util.mapToXml("key", map);
   Log.d(TAG, "getLocalFingerprint  " + key);
   return key;
 }