package com.ccsoft.plugin;

import java.util.Dictionary;
import java.util.Hashtable;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;

import android.util.Log;

import com.parse.ParseInstallation;

public class CordovaParse extends CordovaPlugin {
	
	private final String TAG = "CordovaParse";
	
    @Override
    public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
    	Log.i(TAG, "action:" + action);

    	if (action.equals("getInstallationId")) {
			String id = ParseInstallation.getCurrentInstallation().getInstallationId();
			Log.d("Parse.com Plugin", "Installation Id: " + id);
			callbackContext.success(id);
			return true;
    	}
    	
    	if (action.equals("setKeyValue")) {
			if(args.length() >= 2) { 
				ParseInstallation inst = ParseInstallation.getCurrentInstallation();
				String key = args.getString(0);
				String value = args.getString(1);
				inst.add(key, value);
				inst.saveEventually();
				Log.d("Parse.com Plugin", "Saved key: " + key + " and value: " + value);
					
				callbackContext.success("");
				return true;
			}
    	}
    	
        return false;
    }
}
@@ -25,66 +25,8 @@
 n;%0A%0A
-import java.util.Dictionary;%0Aimport java.util.Hashtable;%0A%0A
 impo
@@ -630,36 +630,21 @@
 %0A%09%09%09Log.
-d(%22Parse.com Plugin%22
+i(TAG
 , %22Insta
@@ -955,11 +955,11 @@
 nst.
-add
+put
 (key
@@ -1007,28 +1007,13 @@
 Log.
-d(%22Parse.com Plugin%22
+i(TAG
 , %22S
@@ -1099,16 +1099,99 @@
 %22%22);%0A%09%09%09
+%7D else %7B%0A%09%09%09%09callbackContext.error(%22invalid number of params passed%22);%0A%09%09%09%7D%0A%09%09%09%09%0A%09%09
 %09return 
@@ -1195,21 +1195,16 @@
 rn true;
-%0A%09%09%09%7D
 %0A    %09%7D%0A
@@ -1238,8 +1238,9 @@
 %0A    %7D%0A%7D
+%0A

Use put instead of add