O'Reilly logo

NativeScript for Angular Mobile Development by Nathanael J. Anderson, Nathan Walker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing DatabaseService

Our DatabaseService needs to provide several things:

  • A persistent store to save and retrieve any data our app needs.
  • It should allow any type of data to be stored; however, we will specifically want it to handle JSON serialization.
  • Static keys of all the data we will want to store. 
  • A static reference to a saved user? Well, yes it could. However, this brings up a point that we will address in a moment.

Regarding the first item, we can use NativeScript's application-settings module. Under the hood, this module provides a consistent API to work with two native mobile APIs:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required