hello, i have a problem in inserting JSON document. i have wrote the code based the tutorial but still have errors

0 votes
asked May 18, 2016 in Android by biel_pumpkin (10 points)

1 Answer

0 votes
Hi Biel,

 

Could you please share some more details like what is the exception message, the internal logs of App42 method? It will help us to provide better support to you.

 

To print internal logs, put below line of code just after the key initialization:

 

App42Log.setDebug(true);

 

regards,

Himanshu Sharma
answered May 18, 2016 by hs00105 (2,005 points)
Thank you for your respond.
It said that:
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.

Here is my code and  ** are the errors :
 String dbName = "BIOBRAINDB";
    String collectionName = "User";
    String json = "{\"userName\":\"\" ,\n" +
            "      \"emailAddress\":\"\",\n" +
            "      \"password\":\"\"\n" +
            "    }";
**    App42API.initialize(null,
  "47c25a34dcedebfaf905a1a8104fec4b1c4310044b860da96d8376db3c53a2f7",
            "8c702171c57f5fcd428e7bc98bafb8193a98a99fff07c77e9295883ee1ab50c5");
    StorageService storageService = App42API.buildStorageService();
** storageService.insertJSONDocument(dbName, collectionName, json,new App42CallBack() {
**      public void onSuccess(Object response)
        {
**           Storage  storage  = (Storage)response;
            System.out.println("dbName is " + storage.getDbName());
            System.out.println("collection Name is " + storage.getCollectionName());
            ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();
            for(int i=0;i<jsonDocList.size();i++)
            {
                System.out.println("objectId is " + jsonDocList.get(i).getDocId());
                System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());
                System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());
                System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());
            }
        }
    public void onException(Exception ex)
    {
        System.out.println("Exception Message"+ex.getMessage());
    }
});
        }
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...