feedhenry / fh-android-sdk

FeedHenry Android SDK
Apache License 2.0
5 stars 16 forks source link

Issue after updating the android sdk #9

Closed briangallagher closed 10 years ago

briangallagher commented 10 years ago

After updating to the latest android sdk I got the following exception thrown.

06-12 09:50:19.076 2004-2031/com.daa E/com.feedhenry.sdk.FHRemote﹕ Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead. java.lang.IllegalArgumentException: Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead. at com.loopj.android.http.AsyncHttpClient.sendRequest(AsyncHttpClient.java:1055) at com.loopj.android.http.AsyncHttpClient.post(AsyncHttpClient.java:892) at com.feedhenry.sdk.FHHttpClient.post(FHHttpClient.java:54) at com.feedhenry.sdk.FHRemote.executeAsync(FHRemote.java:44) at com.daa.server.FHAgent.call(FHAgent.java:74) at com.daa.server.FHAgent.getSecurity(FHAgent.java:55) at com.daa.model.Security.SecurityModel.fhCall(SecurityModel.java:63) at com.daa.model.TimerModel.onTime(TimerModel.java:100) at com.daa.model.TimerModel$1.run(TimerModel.java:55) at java.util.Timer$TimerImpl.run(Timer.java:284)

We added the following before executing the asyncTask

Looper.prepare();

i.e.

Looper.prepare(); //Wei FHActRequest request = FH.buildActRequest(act, params); request.executeAsync(callback);

This got us past the previous issue but resulted in the following exception:

java.lang.RuntimeException: Only one Looper may be created per thread

wei-lee commented 10 years ago

Fixed in #11