4.12, 4.13-Saving User Progress on a Screen

csdunit4

#1

One of my teams is developing an app where they want to be able save the users progress so that the user can start where they left off the next time they return to the app. Does App Lab have the ability to do this? If so, how?


#2

This is something that App Lab can do, but it’s pretty far outside the scope of what students are learning in Unit 4. The full version of App Lab includes a set of data tools that allow a program to record either simple key-value pairs, or to use a table of data as a database. Students can access full App Lab by clicking “Remix” on any of their project levels.

The simplest (though kinda hacky) way to do this would be to record a key-value pair for each user, where they key is the user’s id (which you can find with getUserId()) and the value is the ID of the last screen they visited, using something like this example app https://studio.code.org/projects/applab/DbtLTRJpwBwUYTDVzr5Q1w/view

The more correct approach would be to record the data in tables, but it requires a lot of concepts that students haven’t learned yet (including arrays and objects). For the sake of comparison, here’s a version using tables https://studio.code.org/projects/applab/WknCxGnA5V9oegM2QgXFEg/view

All that said, unless the students are super gung ho about exploring these extra functions, I’d redirect them towards working on making their prototype clearly communicate their design goals. Remember that the point of this project isn’t to create a fully functional app, but to do some quick iteration to get feedback on an idea, which probably doesn’t require that the app remembers where you left off.