akvo / akvo-flow-mobile

Akvo Flow app
GNU General Public License v3.0
18 stars 16 forks source link

Do not check for new surveys before Device ID is set #454

Closed stellanl closed 7 years ago

stellanl commented 8 years ago

The cause of akvo/akvo-flow#1731 When app is run for the first time, it puts up AddUserActivity to ask for user name and device id, but in the background SurveyDownloadService immediately queries the server for surveys, at which point it appears in the device list. Unless there are network problems, this happens before the device ID has been set, so until the next survey check, it will be in the device list without the user-set ID. AddUserActivity does not, in contrast with PreferencesActivity, start SurveyDownloadService to propagate the new device ID.

Suggested solution:

  1. In SurveyActivity, if AddUserActivity is called, skip starting SurveyDownloadService.
  2. In AddUserActivity, start SurveyDownloadService when a device ID has been set. (Exactly like in PreferencesActivity.) Alternatively, we could do just 2. which will at least minimise the window during which a device without an ID is visible.
janagombitova commented 7 years ago

No test plan, but the device ID is shown right away in the device list with the device as well. So passes 👍