1

I'm using Yigits fork of the Path Android Job Queue library to make API calls. I've made a simple class to ping the API. In the class constructor I'm calling super() like this:

super(new Params(Priority.LOW).groupBy(GROUP).requireNetwork().persist());

and then making the actual call in the onRun() method:

@Override
public void onRun() throws Throwable {
    Call<String> request = mAPI.getPing();
    request.enqueue(new PingCallback());
}

The problem is, if I use .persist() in the constructor, onRun() is never called. If I remove it, the call is made and everything works. The Job is serializable (as it extends BaseJob which in turn extends Job from the lib, which implements Serializable), so that's not the cause. The onAdded() method is empty. Can anyone please help me out with this one.

Thanks :)

MadG
  • 94
  • 6
  • Same problem here. I suspect that the problem is about what objects are using in the class that extends Job. I think that all objects has to be serializable But I haven't tried yet – Lorenzo Braghetto Jan 28 '16 at 22:11

1 Answers1

2

I confirm. All the Objects you pass to the constructor (probably all the objects you use) must be Serializable.

A trick could be to decleare "transient" the objects that are not serializable (such as Context). But in this way you can use this objects only in the constructor...in onAdded, onRun etc... they will be null.