Android Question problem Start Main Activity

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hello to all,
for days I am having a problem related to the closure of the app from the recent apps list.

When you close the app from the list and wait about 10 minutes, it does not load the layout. From the log I see that are not called the Activity_Create and Activity_Resume events.

I did several tests, even with the new feature introduced by the 6.3 Service_TaskRemoved to close the Activity but I could not.

If I close and open the app now works. If I rotate the screen, leave messages, and the layout is loaded.

I ask for help.
 

Attachments

  • test.zip
    7.7 KB · Views: 129
  • work.png
    work.png
    7.6 KB · Views: 164
  • not work.png
    not work.png
    2.5 KB · Views: 156

lemonisdead

Well-Known Member
Licensed User
Longtime User
Confirmed. It seems to appear because you restart the Starter service when the task has been killed (I have made the test removing the StartServiceAt and the layout reloaded). As Erel already told us, we should not start the Starter service by ourselves but let the activity / other service, restart it.
So, if you need to make background tasks, I recommend you to make them in another service and restart that one from the Service_TaskRemoved instead of the Starter. Again, Starter will be restarted by the other service by itself.

Edit: proposal attached
 

Attachments

  • Proposal.zip
    8.2 KB · Views: 150
Last edited:
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
Confirmed. It seems to appear because you restart the Starter service when the task has been killed (I have made the test removing the StartServiceAt and the layout reloaded). As Erel already told us, we should not start the Starter service by ourselves but let the activity / other service, restart it.
So, if you need to make background tasks, I recommend you to make them in another service and restart that one from the Service_TaskRemoved instead of the Starter. Again, Starter will be restarted by the other service by itself.

Edit: proposal attached

I understood that the starter service could restart on its own!

I think you could improve this behavior.

Thank you for your answer and example.
 
Upvote 0
Top