Android and background applications -
i unable find out application active(in background) or not.
for example, if user in activity (launcher/main activity) , navigates activity b, goes in background after time or if android needs memory it'll kill application , next time if user wants bring app background, or start home screen bring him activity a, despite sent background activity b on top of activity stack.it logical android returns application user left it.
previously, tried handle static variable, found out android kills application write variable lost.
it nice, if there notification android os before kills applications. desperately searching workaround solution didn't found fills needs.
i grateful if point me kind of solution.
update :
i have logic restoring data don't know if application in background or not ?
i want
if(inbackground) { restore(); }
try this: on baseactivity activities extend:
protected static boolean isvisible = false; @override public void onresume() { super.onresume(); setvisible(true); } @override public void onpause() { super.onpause(); setvisible(false); } whenever need check if of application activities in foreground check isvisible();
Comments
Post a Comment