Using On-Device Resources

Objectives

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

  1. Create a table to store a list of preferences for the current user.

    1. In a new SAP Build Apps project, open the Data tab.

    2. Go to On-Device Storage and choose Create Data Entity.

    3. 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.

  2. Add the following fields:

    • User
    • Color
    • Font Size
    1. For each field, choose Add New.

    2. Enter the name, set the field’s data type to Text, and choose Add.

    3. 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 will display by date on a separate page.

Exercise Options

To start the exercise, choose Start Exercise in the figure below.

A pop-up opens. You have the following options:

  • Start: the simulation starts. Follow the simulation to learn how to create a tracker with on-device storage.
  • Open PDF Document: a pdf opens. Based on the steps described in this document, you can perform the exercises in your own system landscape.

Log in to track your progress & complete quizzes