Stop Android for killing my Activity after 30 minutes from background

人走茶凉 提交于 2019-12-24 11:36:51

问题


I am creating an application where there is an activity which contains a timer running when ever user comes to that screen. If user leaves that screen by pressing home button without stopping the timer then the user is notified by the notification and then if the user again come back to the app from any means then the same screen should appear.

It is working fine if the user comes back to the screen before 30 minutes. Because after 30 minutes android kills my activity from background and my application starts from beginning.

I want to stop android for killing my activity from background. Please help if any body has any idea...

Thanks.

How can i link an Activity to a service? So that when Android OS tries to destroy my activity then it won't let it do because my activity is linked with the running service.


回答1:


Use Services to doing background work. In this case Activity should be like a simple UI facade linked to Service.



来源:https://stackoverflow.com/questions/9373643/stop-android-for-killing-my-activity-after-30-minutes-from-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!