Closed anu-rock closed 12 years ago
Probably you do network requests in the UI thread. Try to execute wordnik requests in another thread using AsyncTask, it works.
On Wed, Nov 14, 2012 at 11:11 PM, Anurag Bhandari notifications@github.comwrote:
While searching for free dictionary APIs, I stumbled upon Wordnik. And from Wordnik's site, I came to know about this awesome Java wrapper for their APIs. I immediately applied for an API key, got one within a few minutes, and set out testing API method calls.
Using knicker's latest JAR file (v2.3.2), I was successfully able to run the example code as mentioned on knicker's official websitehttp://jeremybrooks.net/knicker/. But when I tried to run the same code in an Android app I'm developing, I couldn't get past this exception message:
net.jeremybrooks.knicker.KnickerException: Error getting a response from the server. at net.jeremybrooks.knicker.Util.doGet(Util.java:144) at net.jeremybrooks.knicker.Util.doGet(Util.java:85) at net.jeremybrooks.knicker.AccountApi.apiTokenStatus(AccountApi.java:96)
I suspected this could be because of a missing Internet permission in my app. I added the missing permission in my app's manifest.xml:
but I still kept getting the same error. Any idea what could be wrong? Do I need to add any more permissions in my app's manifest?
~ Complete list of permissionshttp://developer.android.com/reference/android/Manifest.permission.htmlfor your reference ~
— Reply to this email directly or view it on GitHubhttps://github.com/jeremybrooks/knicker/issues/3.
@USAWal Thanks a lot. It worked!
It would help if you could tell the reason behind this logic.
Sure. Since Honeycomb I guess network requests rise fatal error, because of poor performance. We should reduce using main thread for slow operation. Read this article
While searching for free dictionary APIs, I stumbled upon Wordnik. And from Wordnik's site, I came to know about this awesome Java wrapper for their APIs. I immediately applied for an API key, got one within a few minutes, and set out testing API method calls.
Using knicker's latest JAR file (v2.3.2), I was successfully able to run the example code as mentioned on knicker's official website. But when I tried to run the same code in an Android app I'm developing, I couldn't get past this exception message:
I suspected this could be because of a missing Internet permission in my app. I added the missing permission in my app's manifest.xml:
but I still kept getting the same error. Any idea what could be wrong? Do I need to add any more permissions in my app's manifest?
~ Complete list of permissions for your reference ~