After completing this lesson, you will be able to:
After completing this lesson, you will be able to:
Describe the purpose of on-device storage
Create an on-device storage entity and access it from an app
Purpose of On-Device Storage
On-device storage lets you store information specific to the current user that does not need to be shared with other users. It is available offline without needing to call a back-end system using the internet.
Examples of the type of data that could be stored on-device are:
Personal settings/preferences for the app
Temporary data that is not ready to be sent to a back-end data source
Data to allow offline use of the app
Data only related to the current user
The data is stored either on the device (for mobile apps) or in the browser (for web apps), but the most important thing to remember is that the data is only available to the current user since it is stored on their device only.
Create On-Device Storage
Business Scenario
Create a table to store a list of preferences for the current user.
Steps
Create a table to store a list of preferences for the current user.
In a new SAP Build Apps project, open the Data tab.
Go to On-Device Storage and choose Create Data Entity.
In the Name field, enter Preferences (the name of the data entity), and choose Add.
This will open a screen for defining the entity’s fields.
Add the following fields:
User
Color
Font Size
For each field, choose Add New.
Enter the name, set the field’s data type to Text, and choose Add.
Choose Save (upper right).
Create a Tracker with on-Device Storage
Business Scenario
In this simulation, the On-Device Storage is used to make the Health Tracking feature of the Home screen functional. Here, the values of the icons are transferred and stored by choosing the button and displayed by date on a separate page.
Follow the simulation to learn how to create a tracker with on-device storage.