获取UUID

	//public static String UUID_KEY = "uuid_key";
	//public static String CONFIG = "config_file";
	public static String getUUid(Context context) {
		SharedPreferences sp = context.getSharedPreferences(CONFIG, 0);
		String uuid = sp.getString(UUID_KEY, "");
		if ("".equals(uuid)) {
			uuid = UUID.randomUUID().toString();
			uuid = uuid.replaceAll("-", "") + "";
			Editor ed = sp.edit();
			ed.putString(UUID_KEY, uuid);
			ed.commit();
		}
		return uuid;
	}


 

你可能感兴趣的:(获取UUID)