I am in the same situation. Finally, I decided to do something like this:
Actions or fragments are not available, they do not know anything about MVP, but I'm going to use the event bus, for example Otto, to send signals / events, So:
My classes, which are produced by some Leader, do not know anything about the Android context, but they will have the MvpView interface, only with onAttachPresenter and onDetachPresenter.
A class that extends Service will have a Presenter attribute and implement some MvpView interface with onSucess, onError, onStart, onComplete or something similar, and the same events for Otto (onSucessEvent, onErrorEvent, onStartEvent, onCompleteEvent).
Therefore, when I need to do something, the action or fragment will start the service, the service will "start" or talk to the Leader and when the leader finishes successfully, it will call mvpView.onSuccess () and save the information inside the local database with SQLite (possibly storeIO) and finally, the Service will call Otto and transmit a signal (without any data), possibly onComplete. Finally, the signal will be captured by my UI (possibly a fragment) and get all the information inside the database in SQLite.
So, when onSucess happens, the user interface will show the latest and best data, but if onError happens, then (at least) will show some information (or not, if you want), telling the user: "there was a problem, but at least you can see something, bot onSuccess and onError will throw onComplete in the end.
I do not know if this is the best solution, but in this case I think that I will not deal with the life cycle of actions or fragments and do not care about onSaveInstance and do not restore data when the user rotates the device. It will always receive the latest data inside the database, and if something happens (there is no Internet connection), you can at least show something when you receive the onComplete signal.
Some facts that I still think are:
- The leader will not be a single class
- The host knows nothing about the Context, but yes with the MyApplication class
- What happens if on the same screen (Fragment) you have different services with different sides in AccessEvents? Just use some action as an identifier to identify them.
- Never make an Activity Snippet implement MvpView, you have to deal with the life cycle.