use of org.json.JSONException in project clutchandroid by clutchio.
the class ClutchStats method testFailure.
public void testFailure(String name, String type) {
JSONObject data = new JSONObject();
try {
data.put("action", "failure");
data.put("name", name);
data.put("type", type);
} catch (JSONException e) {
Log.e(TAG, "Could not create JSON for insert into testFailure (name: " + name + ", type: " + type + ")");
return;
}
logABData(data);
}
use of org.json.JSONException in project clutchandroid by clutchio.
the class ClutchStats method goalReached.
public void goalReached(String name) {
JSONObject data = new JSONObject();
try {
data.put("action", "goal");
data.put("name", name);
} catch (JSONException e) {
Log.e(TAG, "Could not create JSON for insert into goalReached (name: " + name + ")");
return;
}
logABData(data);
}
use of org.json.JSONException in project clutchandroid by clutchio.
the class ClutchStats method testChosen.
public void testChosen(String name, int choice, int numChoices) {
JSONObject data = new JSONObject();
try {
data.put("action", "test");
data.put("name", name);
data.put("choice", choice);
data.put("num_choices", numChoices);
} catch (JSONException e) {
Log.e(TAG, "Could not create JSON for insert into testChosen (name: " + name + ", choice: " + choice + ", numChoies: " + numChoices + ")");
return;
}
logABData(data);
}
use of org.json.JSONException in project clutchandroid by clutchio.
the class ClutchStats method getABLogs.
public ArrayList<ABRow> getABLogs() {
SQLiteDatabase db = getReadableDatabase();
String[] args = {};
ArrayList<ABRow> res = new ArrayList<ABRow>();
Cursor cur = db.rawQuery("SELECT uuid, ts, data FROM ablog ORDER BY ts", args);
cur.moveToFirst();
while (!cur.isAfterLast()) {
String uuid = cur.getString(0);
double ts = cur.getDouble(1);
JSONObject data;
try {
data = new JSONObject(cur.getString(2));
} catch (JSONException e) {
Log.w(TAG, "Could not serialize to JSON: " + cur.getString(3));
cur.moveToNext();
continue;
}
res.add(new ABRow(uuid, ts, data));
cur.moveToNext();
}
db.close();
return res;
}
use of org.json.JSONException in project clutchandroid by clutchio.
the class ClutchStats method setNumChoices.
public void setNumChoices(String name, int numChoices, boolean hasData) {
JSONObject data = new JSONObject();
try {
data.put("action", "num-choices");
data.put("name", name);
data.put("num_choices", numChoices);
data.put("has_data", hasData);
} catch (JSONException e) {
Log.e(TAG, "Could not create JSON for insert into testChosen (name: " + name + ", numChoices: " + numChoices + ")");
return;
}
logABData(data);
}
Aggregations