开发者

Android App quits automatically if its idle for some hours

I created an new Android app and succeeded in its working. Its all functionality are working fine. While starting it will ask use name and password.

What my problem was "If my Application is idle for some 4 to 5 hours, then automatically it get quit , while restarting its again asking to login"

I need to know how to avoid automatic quit of my app. I'm sorry if its simple or already开发者_如何学JAVA asked quetions.


I need to know how to avoid automatic quit of my app.

No, you do not. Simply redirect the user to log in again, or, as @Rasel suggests, persistently cache credentials in a file or database or something.

Android applications do not and must not live forever. Phones have limited RAM. Android will terminate unused applications after a period of inactivity, to free up RAM for other applications. This is perfectly normal, just as it is perfectly normal for a user to close a Web browser after visiting a Web app.


Its completely natural for the android application.Android OS automatically kill the process when it needs to do.So if you want keep your application alive you have to think differently.To keep always running you can use service that will monitor your application states and handle the situation when it prompts for the login info again.

Another option you can write the login information in the shared preference and can clean when user intentionally leave the application.So when starting again if you find the information you can directly prompt to the user without entering the login information

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜