package com.permutassep.presentation.utils;

import com.parse.ParseInstallation;

/**
 * By Jorge E. Hernandez (@lalongooo) 2015
 */

public class ParseUtils {

    private static final String PARSE_INSTALLATION_COLUMN_PS_USER = "PSUser";

    public static void setUpParseInstallationUser(int userId) {

        ParseInstallation installation = ParseInstallation.getCurrentInstallation();
        if (installation.get(PARSE_INSTALLATION_COLUMN_PS_USER) == null
                ||
                Integer.valueOf(installation.get(PARSE_INSTALLATION_COLUMN_PS_USER).toString()) != userId) {
            installation.put(PARSE_INSTALLATION_COLUMN_PS_USER, userId);
            installation.saveInBackground();
        }
    }

    public static void clearParseInstallationUser() {
        ParseInstallation installation = ParseInstallation.getCurrentInstallation();
        installation.put(PARSE_INSTALLATION_COLUMN_PS_USER, -1);
        installation.saveInBackground();
    }
}

@@ -375,32 +375,142 @@
 Installation();%0A
+        installation.put(PARSE_INSTALLATION_COLUMN_PS_USER, userId);%0A        installation.saveEventually();%0A//
         if (inst
@@ -565,16 +565,18 @@
 == null%0A
+//
         
@@ -586,16 +586,18 @@
      %7C%7C%0A
+//
         
@@ -693,24 +693,26 @@
 = userId) %7B%0A
+//
             
@@ -764,32 +764,34 @@
 _USER, userId);%0A
+//
             inst
@@ -815,24 +815,26 @@
 ckground();%0A
+//
         %7D%0A  
@@ -1063,36 +1063,34 @@
 llation.save
-InBackground
+Eventually
 ();%0A    %7D%0A%7D%0A

Use saveEventually() instead of saveInBackground()