115
© Peter Späth 2018
P. Späth,
Pro Android with Kotlin,
https://doi.org/10.1007/978-1-4842-3820-2_8
Chapter
8
APIs
The subject of this
chapter is to introduce APIs, which are the cornerstones of your app.
The APIs include the following:
Databases
Scheduling
Loaders
Notifications
Alarm Manager
Contacts
Search
Framework
Location and Maps
Databases
Android provides two realms for dealing with databases: either
you use the SQLite library
included in the Android OS, or you use the Room architecture component. The latter is
recommended since it adds an abstraction layer between
the database and the client,
simplifying the mapping between Kotlin objects and database storage objects. You can find
exhaustive information about SQLite in the online docs and lots of examples on the Web. In
this book, we talk about Room since the separation of concerns
induced by the abstraction
helps you to write better code. Also, since Room helps to avoid boilerplate code, you can
shorten your database code significantly if you use Room instead of SQLite.