Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your situation I would pick JSON over XML for all the reason's stated in the following post: <a href="http://ajaxian.com/archives/json-vs-xml-the-debate" rel="nofollow">http://ajaxian.com/archives/json-vs-xml-the-debate</a></p> <p>Plus, in android, there are JSON Array's built in by default so you don't have to do any extra passing of the code.</p> <pre><code>return new JSONArray("my json string goes here..."); </code></pre> <p>Since we are talking about a mobile device, I would always generate changes in your php script rather than have a full sync as this will be a lot smaller in size that a full sync. However, you will need to give your user a option to do a full re-sync if this is applicable to your app. I would use a SQLite database to store the data and only update the changes in that.</p> <p>To also make the stream smaller, you can gzip compress your output from php as this can be natively read by the android device. In my app, I compress 500kb down to ~110kb before transmitting, a huge saving on performance. Here a partial example of how to read the stream:</p> <pre><code>InputStream in = null; HttpURLConnection httpConn = null; // you will have to write your on code for this bit. if (httpConn.getContentEncoding() != null) { String contentEncoding = httpConn.getContentEncoding().toString(); if (contentEncoding.contains("gzip")) { in = new GZIPInputStream(httpConn.getInputStream()); } } else { in = httpConn.getInputStream(); } </code></pre> <p>I hope that this all makes sense, it's been a long day programming :)</p> <p>Stu</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload