robospice

RoboSpice requests results when user taps home button

徘徊边缘 提交于 2020-02-04 07:17:51
问题 We are using Robospice 1.4.12 with okhttp. Everything is working fine except getting the results from a request when user taps home button and then comes back to the activity. Example: we fire a request and then press home button and we wait for request to finish, when we come back to the activity the listener never gets notified. If we come back before the request finishes everything works ok. Orientation changes are working fine. We are using LruCacheObjectPersister for in memory cache. Now

Robospice - keep spice service continue running when changing activity

♀尐吖头ヾ 提交于 2020-01-12 07:29:27
问题 I used RoboSpice library to do asynchronous tasks. From their examples, the spice service is declared in BaseActivity, it starts in activity's onStart method, and stops in activity's onStop. Everything is fine, but when I want download file from internet, and then I change to another activity, this download task is cancelled, because the spice service is stopped. It looks like: public abstract class BaseActivity{ /** The request manager. */ private SpiceManager requestManager = new

RoboSpice with Gson and Realm

北城余情 提交于 2019-12-22 05:17:11
问题 I'm using RoboSpice with GsonSpringAndroidSpiceService. I also want to add Realm to save the data. the problem is that in realm each object has to extend realmObject, but the gson in the roboSpice trying to parse the realmObject instead of ignore it. I've tried to add exclusion stategy: Gson gson = new GsonBuilder() .setExclusionStrategies(new ExclusionStrategy() { @Override public boolean shouldSkipField(FieldAttributes f) { return f.getDeclaringClass().equals(RealmObject.class); } @Override

How does robospice manage activity lifecycle?

江枫思渺然 提交于 2019-12-22 03:49:07
问题 I'm looking for a technical answer to how the android robospice library manages activity lifecycle. From the getting started page: https://github.com/octo-online/robospice/wiki/Starter-Guide "As an inner class of your Activity (or other context), add a RequestlListener that will update your UI. Don't worry about memory leaks, RoboSpice manages your activity's life cycle." My question is how does robospice automatically update the request listeners so that it still is able to call the correct

Handling specific errors by sending another request transparently in retrofit

泪湿孤枕 提交于 2019-12-20 16:14:14
问题 Here's the case I'm trying to handle, If a request is executed, and the response indicates the auth token is expired, send a refresh token request if the refresh token request succeeds, retry the original request This should be transparent to the calling Activity, Fragment... etc. From the caller's point of view, it's one request, and one response. I've achieved this flow before when using OkHttpClient directly, but I don't know how to achieve this in Retrofit. Maybe something related to this

Using RoboSpice is there a way to get the HTTP Error Code out of an exception?

主宰稳场 提交于 2019-12-20 08:49:44
问题 I am writing an application that uses RoboSpice. In the request listener onRequestFailure( SpiceException arg0 ) is there a way to know for sure that the error was a result of a 401 HTTP Error occurred? I have a back end service, that returns a 401 error when a token expires, when that occurs I need to prompt the user to re-enter their credentials. Is there anyway to know that a 401 HTTP error specifically occurred? Below is an example of my request. public class LookupRequest extends

RoboSpice persist JSON array with OrmLite

让人想犯罪 __ 提交于 2019-12-19 07:49:37
问题 I'm using RoboSpice with Spring for Android and would like to persist a JSON array of objects with OrmLite. GSON is used for the JSON marshalling. With the default caching everything works as expected. But OrmLite doesn't seem to like the array of objects. This is a simplified version of the JSON: [{"id": 1, "title": "Test 1"},{"id": 2, "title": "Test 3"},{"id": 3, "title": "Test 3"}] I would like to persist this in the following object: @DatabaseTable public class Foo { @DatabaseField(id =

Failed to build sample robospice-sample-ormlite-content-provider Robospice

混江龙づ霸主 提交于 2019-12-14 03:58:49
问题 unable to build the project robospice-sample-ormlite-content-provider I use maven: [ERROR] Failed to execute goal on project robospice-sample-ormlite-content-provi der: Could not resolve dependencies for project com.octo.android.robospice:robos pice-sample-ormlite-content-provider:apk:1.0.0-SNAPSHOT: Could not find artifact com.octo.android.robospice:robospice-spring-android:jar:1.4.6-SNAPSHOT -> [Help 1] I tried for more than 2 hours with all solutions found online with no luck. Can any one

Robospice - addListenerIfPending - how do I know if request WAS found?

可紊 提交于 2019-12-14 02:35:41
问题 I am trying to implement a very simple case using robospice: a login screen. When login button is clicked, loading animation is shown and request is made using SpiceManager.execute(..) (without caching, of course. Since it's a login request, I need to do actual call to the server every time). So, to handle screen rotations, etc., in Activity.onStart() I should use SpiceManager.addListenerIfPending(..) , and if request is actually pending, I should show loading animation without doing any real

Robospice retry policy custom implementation

╄→尐↘猪︶ㄣ 提交于 2019-12-13 05:13:45
问题 I need to implement such behaviour. Something like polling remote web server for the some period of time, checking for the condition in response from the server, for example variable condition. To be more specific, consider an example. I need to poll server every 5 secodns during 5 minutes and than fail. There is great feature in Robospice library - RetryPolicy, nearly what I need. I has getRetryCount, getDelayBeforeRetry methods. Exactly what I need to implement my task. But I need to