0

My Question is

Is there any free library which converts response from server to sqlite database.User should have data online/offline.

if connection was there response will be from server update db

if connection was not there response will be directly from db.

How to proceed with converting resposne to sqlite database.

Any links or sample code helps me alot

Thanks in Advance

Manju
  • 720
  • 9
  • 23

2 Answers2

0

You can write a service which checks for server connection.

If connection is there then get the Json ,parse it and store it in the DB as you need

If there is no connection then use the Db values.

You can use This link to convert the json to dbObject.

Abx
  • 2,852
  • 4
  • 30
  • 50
  • thanks for quick reply hope link will help.Will check and update you – Manju Apr 16 '13 at 06:22
  • i had written the code which is in link but throwing illegal argument exception while creating db.please kindly let me know what will be the problem below is the code MongoURI uri=new MongoURI(url); mongo = new Mongo(uri); db = mongo.getDB("contacst.db"); collection = db.getCollection(TAG_CONTACTS); – Manju Apr 16 '13 at 06:52
  • try db = mongo.getDB("contacst"); instead of db = mongo.getDB("contacst.db"); – Abx Apr 16 '13 at 06:58
  • its exception related creating uri not creating db can you tell how to create mongo object for this api http://api.androidhive.info/contacts/ – Manju Apr 16 '13 at 07:01
  • sorry i guess this mongodb wont work i guess check this link http://stackoverflow.com/questions/8808513/android-my-application-wont-run-because-i-need-to-handle-an-unknownhostexcepti – Manju Apr 16 '13 at 07:17
0

I don't think such library exist. You should do it by yourself. For service you could write isAlive() method and for json to db. I suggest this.

Community
  • 1
  • 1
cahit beyaz
  • 4,829
  • 1
  • 30
  • 25