Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid FQL Call Returning Empty after Successful Calls [Title Changed]
    primarykey
    data
    text
    <p>Ok Here's my problem.</p> <p>I am making an FQL query and I am storing the response data. My code runs fine, except after about 4 minutes of the app running I get a JSONException. The Exception reads</p> <pre><code> A JSONArray text must start with '[' at character 0 of </code></pre> <p>Which is strange, because if I type in the URL the query is making into a browser I get the following</p> <pre><code>[{"uid":SOMENUMBER},{"uid":SOMENUMBER}] </code></pre> <p>Which clearly begins with the "[" character.</p> <p>Here's the request</p> <pre><code> String query = "SELECT uid FROM user WHERE is_app_user=1 and uid IN (SELECT uid2 FROM friend WHERE uid1 =" + fbId + ")"; Bundle params = new Bundle(); params.putString("method", "fql.query"); params.putString("query", query); mAsyncFacebookRunner.request(null, params, new FQLRequestListener()); </code></pre> <p>Here's the RequestListener</p> <pre><code> private class FQLRequestListener implements RequestListener { @Override public void onComplete(String response, Object state) { try { JSONArray json = new JSONArray(response); friendsIds = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; json.length(); ++i) { String uid = json.getJSONObject(i).getString("uid"); friendsIds.add(uid); Log.d("friends", friendsIds.get(i)); } InviteFriends.this.runOnUiThread(new Runnable() { @Override public void run() { setUpList(); } }); } catch (JSONException e) { e.printStackTrace(); } } </code></pre> <p>And the Stack..</p> <pre><code>06-15 16:43:21.744: D/Facebook-Util(866): GET URL: THIS IS THE URL THAT WORKS IN A BROSWER (actual URL removed) 06-15 16:43:21.774: W/System.err(866): org.json.JSONException: A JSONArray text must start with '[' at character 0 of 06-15 16:43:21.774: W/System.err(866): at org.json.JSONTokener.syntaxError(JSONTokener.java:448) 06-15 16:43:21.774: W/System.err(866): at org.json.JSONArray.&lt;init&gt;(JSONArray.java:104) 06-15 16:43:21.774: W/System.err(866): at org.json.JSONArray.&lt;init&gt;(JSONArray.java:150) 06-15 16:43:21.774: W/System.err(866): at rageup.android.InviteFriends$FQLRequestListener.onComplete(InviteFriends.java:129) 06-15 16:43:21.774: W/System.err(866): at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:254) </code></pre> <p>I should note that..</p> <ol> <li><p>Query works when I logout and log back in.</p></li> <li><p>I have ensured my Facebook session is valid.</p></li> <li><p>The Facebook provided "Hackbook" example has the same problem when downloading a friend's list.</p></li> </ol> <p>Flow of Getting the Exception</p> <ol> <li><p>Home Page Where User Logs In</p></li> <li><p>User Clicks a Button to Start Second Activity </p></li> <li><p>Second Activity is Where Query is Made</p></li> <li><p>Return Home</p></li> <li><p>Repeat after about 4 minutes, minus the login</p></li> </ol>
    singulars
    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.
 

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