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
Post a Comment