Permalink
Browse files

sending correct json structure

  • Loading branch information...
Jon Vlachoyiannis
Jon Vlachoyiannis committed Mar 8, 2011
1 parent 7cd7856 commit 79bbd7fa305a6f05a6dc0b05e8feab910e4356d0
Showing with 25 additions and 8 deletions.
  1. +1 −1 README.rst
  2. +23 −6 src/com/sfalma/trace/Sfalma.java
  3. +1 −1 src/com/sfalma/trace/SfalmaHandler.java
View
@@ -4,7 +4,7 @@ Sfalma Android
How to use it
------
-After you build the project (see Build section), copy sfalma-trace.jar into your project libraries and import it to your project:
+After you build the project (see Building section), copy sfalma-trace.jar into your project libraries and import it to your project:
import com.sfalma.trace.SfalmaHandler;
@@ -39,13 +39,30 @@
public class Sfalma {
public static String createJSON(String app_package, String version, String phoneModel, String android_version, String stackTrace) throws Exception {
- JSONObject json = new JSONObject();
+ JSONArray json = new JSONArray();
+
+ JSONObject request_json = new JSONObject();
+ JSONObject exception_json = new JSONObject();
+ JSONObject application_json = new JSONObject();
+ JSONObject client_json = new JSONObject();
+
+ request_json.put("remote_ip", "192.168.0.1");
+ json.put(request_json);
+
+ exception_json.put("occured_at", "today");
+ exception_json.put("message", "java.lang.NullPointerException");
+ exception_json.put("backtrace", stackTrace);
+ json.put(exception_json);
- json.put("phone_model", phoneModel);
- json.put("package_version", version);
- json.put("package_name", app_package);
- json.put("android_version", android_version);
- json.put("strace", stackTrace);
+ application_json.put("phone_model", phoneModel);
+ application_json.put("package_version", version);
+ application_json.put("package_name", app_package);
+ application_json.put("version", android_version);
+ json.put(application_json);
+
+ client_json.put("version", "sfalma-version-1");
+ client_json.put("name", "sfalma-android");
+ json.put(client_json);
return json.toString();
}
@@ -85,7 +85,7 @@
private static ActivityAsyncTask<Processor, Object, Object, Object> sTask;
private static boolean sVerbose = false;
private static int sMinDelay = 0;
- private static Integer sTimeout = null;
+ private static Integer sTimeout = 1;
private static boolean sSetupCalled = false;
public static interface Processor {

0 comments on commit 79bbd7f

Please sign in to comment.