-1

I have similar problem like this.

On start my app displays a splash screen and checks via network if the current user is still premium.

My problem: I started my app right before I went to bed and minimized it by pressing the home button. In the morning I launched the app again and it resumed the activity from the night. The app never really quit, my splash screen was not shown and and it couldn't check if the user is still premium.

So how can I achieve my app to be closed after a certain time (e.g. when the app is minimized)?

But the problem is there is a portion in the app where I can view videos in full screen and here I use android's default player. So when the app is minimized while watching and then again open the app onResume will not be called and cannot check whether it is a registered user or not. The video player will continue to play the video. Is there any method so that I can kill the app when the video is playing and minimised?? is there any method which is called when the app is minimised using home key press?? Is it possible in every device to detect the home keypress event and write some code there?? Please help with some fresh ideas!!!

Community
  • 1
  • 1
Pratheesh
  • 764
  • 1
  • 11
  • 24
  • 1
    It sounds like you already found a question that has your answer. Why can't you just use the app lifecycle correctly as suggested on the question you linked? How is your question different from the linked question? – Dan Hulme Nov 19 '15 at 13:38
  • when I open the minimized tab it open as full video. Only a back button press calls the onResume function in the program. – Pratheesh Nov 19 '15 at 13:46
  • You mean, when you select your task from the recent tasks list, but the video player is still at the front of the task? – Dan Hulme Nov 19 '15 at 13:50
  • exactly. That is what happens to me. – Pratheesh Nov 19 '15 at 14:04

1 Answers1

0

Now I know why my reputation is always low. Thanks Dan Hulme. You are right I just want to use the app lifecycle correctly. I want to use onRestart not onResume. And that have done the work for me. Thanks all.

Pratheesh
  • 764
  • 1
  • 11
  • 24