delight-im / delight-im/Android-DDP
Handling app sleep / screen lock / Activity pause
- Dominant language
- Java
- Stars
- 274
- Forks
- 51
- PR merge metrics
- No merged PRs in 30d
Description
Good day to all of you,
after searching the repo for certain keywords (sleep, onResume, lock..) I didn't come up with an issue talking about this topic and it's not clear from the doc either.
I've written an app that consumes and manipulates data on a Meteor server. Now this app is expected to be used on-and-off over a period of some hours. This, of course, includes users locking their screen and/or switching to a different app from time to time.
I've done a test where I add a new document to a collection and update an existing one after having locked the screen. When I unlock the screen again, I come back to my activity which remains unchanged. When I then add another document or update one, all documents update accordingly.
From this I deduce that the app does not know about changes that happen when the Activity is paused, which is what I'd expect.
Taking a guess I'd say that I have to implement some sort of "refreshing" in the onResume method of the activity. I have already tried calling disconnect/reconnect there, which does not work (probably because of the login which is needed for each and every method).
I'm sure there must be a better solution though.
Thank you!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Activity lifecycle entry point mentioned, onResume, and trace the disconnect/reconnect and login flow described. Reproduce the screen-lock or app-switch scenario and compare collection updates before and after resume. Done should clearly define how changes made while paused become visible without losing the required login state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100