CoVer_App/app/src/main/java/com/example/cover_a01/StorageReadWrite.java
/**
     * Loads in close proximity UUIDs and adds the new UUID to the JSON unless the UUID is
     * already in the file.
     */
Loads in close proximity UUIDs and adds the new UUID to the JSON unless the UUID is
already in the file.
Loads in close proximity UUIDs and adds the new UUID to the JSON unless the UUID is already in the file .
private void writeUuidsToFile(UUID uuid, Context context) throws JSONException, InterruptedException {
        try {
            closeProximityUUIDs = new JSONObject(StorageReadWrite.loadFromFile(context.getApplicationContext(), "proximityUuids.json"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        assert uuid != null;
        if (!closeProximityUUIDs.toString().contains(uuid.toString())) {
            closeProximityUUIDs.put(uuid.toString(), new Date().getTime());
            StorageReadWrite.writeToFile(closeProximityUUIDs.toString(), "proximityUuids.json", context.getApplicationContext());
            Log.i(TAG, "Adding UUID to file : " + uuid);
        }
    }
private void writeUuidsToFile ( UUID uuid , Context context ) throws JSONException , InterruptedException { try { closeProximityUUIDs = new JSONObject ( StorageReadWrite . loadFromFile ( context . getApplicationContext ( ) , "proximityUuids.json" ) ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } assert uuid != null ; if ( ! closeProximityUUIDs . toString ( ) . contains ( uuid . toString ( ) ) ) { closeProximityUUIDs . put ( uuid . toString ( ) , new Date ( ) . getTime ( ) ) ; StorageReadWrite . writeToFile ( closeProximityUUIDs . toString ( ) , "proximityUuids.json" , context . getApplicationContext ( ) ) ; Log . i ( TAG , "Adding UUID to file : " + uuid ) ; } }
Loads in close proximity UUIDs and adds the new UUID to the JSON unless the UUID is
 already in the file.
Loads in close proximity UUIDs and adds the new UUID to the JSON unless the UUID is already in the file .
//Read in proximity UUIDs file //If the UUID is already in ArrayList, don't write the value again //Write proximity uuids back to file