android-activitylifecyclecallbacks-compat
android-activitylifecyclecallbacks-compat copied to clipboard
Using this on Actvity level?
Hi, Can I use this on Activity Level not on Application Level? I mean, suppose I am not using Application class and registering this in Activity A(Main-> Activity A) like this
ApplicationHelper.registerActivityLifecycleCallbacks(mApplication, mActivityLifecycleCallbacks);
in OnCreate()
to get only call back of this activity?
I actually tried this but I am getting callback from Main also.
Is there a way to do thit?because I need to stop request if user goes away from Activity A and resume request when he comes back.
Thanks.
Why don't you simply start / stop monitoring in your Activity's onResume() / onPause()?
Its a library I m working on, so I can't tell everyone that manage request on our own.
I need to detect that and manage if the Activity requesting service is active or hidden with some other activity of the app or any other app.
It should be like a Live Score, If I am checking it, its get refreshed automatically, but if I get a call(scores activity is hidden) so refresh should stop, but after I go back there again it should then immediately refresh and show me current score.
One more thing, Do I need to override method onResume()
, onPause()
etc. in activity if I m not extending LifecycleDispatchActivity
on PRE_ICS devices to get callbacks?
On POST_ICS devices, if I don't override the lifecycle method, I get the callbacks for all methods.But this is not the case in PRE_ICS.
As I see you have written that in order to get callback.
Is there a way to directly get the callback on PRE_ICS devices like we get on POST_ICS devices without overriding each of lifecycle methods in activity class?