Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set device_id and settings_json from MDM #6581

Open
4 of 6 tasks
lognaturel opened this issue Feb 4, 2025 · 2 comments
Open
4 of 6 tasks

Set device_id and settings_json from MDM #6581

lognaturel opened this issue Feb 4, 2025 · 2 comments

Comments

@lognaturel
Copy link
Member

lognaturel commented Feb 4, 2025

Some users manage their device fleets with Microsoft Intune, TinyMDM and other mobile device management solutions.

We've had request to set the device id and full settings from MDM.

Ideally, these values would be updated at app launch and any time the settings are changed on the MDM system.

In practice, it's not essential to perfectly match that ideal behavior. The most important flow for settings_json is when the app has never been configured before. In that case, we want the new project settings picked up as soon as possible AND the UI refreshed so that the user goes in the new active project and is ready to start work. It's also important that if a user is in a Collect project doing work, they are never automatically switched out of that project because MDM settings change.

For both deviceid and settings changes to the existing project, it would be fine for those to be picked up when the user happens to return to the main menu.

High-level user stories

As a project manager, I want to remotely set Collect's deviceid to match the device code in my MDM
So that I can know which device made which submissions when I do data analysis

As a project manager, I want to push settings to create a new project
So that I can remotely configure many devices

As a project manager, I want to push settings to update an existing project
So that I can improve my project's workflow as it's ongoing or troubleshoot issues
Examples: change form update frequency to reduce load on server, show button that was hidden

Release criteria

For full settings, we can use a JSON string following the settings format.

  • Given that Collect is running and managed by MDM
    When I change the device_id key in my MDM system
    Then I should see that reflected next time I look at the settings or access deviceid from a form

  • Given that Collect is running and managed by MDM
    When I change the settings_json key in my MDM system and those settings are invalid
    Then nothing should happen in Collect

  • Given that Collect is running and managed by MDM
    When I change the settings_json key in my MDM system and those settings include a URL+username combination that matches an existing project
    Then that project should be updated to match the settings pushed by MDM

  • Given that Collect is running and managed by MDM
    When I change the settings_json key in my MDM system and those settings include a URL+username combination that does NOT match an existing project
    Then a new project should be created with all of the settings I pushed

  • Given that Collect is running and managed by MDM
    And that Collect is open to the landing screen
    When I set the settings_json key in my MDM
    Then a new project should be created with all of the settings I pushed and I should see the main menu for that project

  • Given that Collect is running and managed by MDM
    When I change the settings_json key in my MDM system and those settings include a URL+username combination that does NOT match an existing project
    Then a new project should be created with all of the settings I pushed
    And I should remain in the project I was in before (the active project should not be changed)

@seadowg seadowg moved this from inbox to not ready in ODK Collect Feb 4, 2025
@lognaturel lognaturel moved this from not ready to ready in ODK Collect Feb 6, 2025
@grzesiek2010
Copy link
Member

@lognaturel

These values should be updated at app launch and any time the settings are changed on the MDM system.

Could you clarify this? I've followed the approach you started in your first commit with the listener in the MainMenuActivity, which means that if the app is closed, the new settings will be loaded when it's reopened. However, if the app is open and another activity, such as form filling, is on top, we would need to return to the main menu to reload the settings. Is that okay?

Pushing new settings should not change the active project.

Please clarify this as well. Only new projects should be created, and if we change settings in an existing one, it needs to be inactive? What's the reasoning behind this? And by settings did you mean just settings or device_id and settings?

@lognaturel
Copy link
Member Author

lognaturel commented Feb 12, 2025

We talked briefly about these but want to put answers for completeness.

we would need to return to the main menu to reload the settings. Is that okay?

Yes, we want to approximate immediate update but some delay is fine as long as it's likely to happen relatively soon after a change is made. What we wouldn't want is for a user to go days/multiple forms filled without the update being reflected.

Only new projects should be created, and if we change settings in an existing one, it needs to be inactive? What's the reasoning behind this?

The idea here was NOT to change the active project so as not to disrupt any ongoing work. This only applies for a scenario in which there are multiple projects configured on the device. For example, a bad outcome would be that I'm working on projectA, a project manager pushes settings to create projectB on my device, and I'm automatically switched there. If the user is on the landing screen, they should be switched into a newly-created project. I'll add to the issue.

And by settings did you mean just settings or device_id and settings?

Both. Though device_id is app-wide so it feels less likely to change the active project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ready
Development

No branches or pull requests

2 participants