On Android, is library able to receive notification that app is backgrounded / foregrounded? -


i'm writing library uses timer perform scheduled background processing. 1 key feature conserve battery life, i'd have library pause background processing when app isn't actively used.

ideally, great if equivalents activity.onpause() , activity.onresume() received library without having create api it. don't want have rely on dev, who's implementing library, have call mylibrary.onpause() , mylibrary.onresume() throughout various activities of app.

are there other solutions apart api's ? thought maybe there broadcast library register - haven't found useful @ moment... looking suggestions...

thanks !!

you can use registeractivitylifecyclecallbacks() set listener activity life cycle events. it's api 14+ should not big deal nowadays.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -