Author: Daniel Passos (dpassos)
Level: Beginner
Technologies: Java, Android
Summary: A basic example of Store : CRUD
Target Product: -
Product Versions: -
Source: https://github.com/aerogear/aerogear-android-cookbook/tree/master/CarStore
The AGDroid CarStore
project demonstrates how to include Store functionality in Android applications.
This simple project consists in CRUD for Android application.
When the application is deployed to an Android device, the application will show all previous data saved
- Java 7
- Gradle 2.2.1
- Latest Android SDK and Platform version 21
$ cd /path/to/carStore/
$ gradle clean build
To deploy, run and debug the application on an Android device attached to your system, on the command line enter the following:
2.1) Install generated apk to device
$ cd /path/to/carStore
$ gradle installDebug
2.2) Open app on device
Application output is displayed in the command line window.
CarStoreApplication
is invoked when open the application. The Application life cycle onStart
is called creating and opening the Car Store database instance.
DataManager.config("carStore", SQLStoreConfiguration.class)
.withContext(getApplicationContext())
.forClass(Car.class)
.store();
store = (SQLStore) DataManager.getStore("carStore");
store.openSync();
After that the CarStoreActivity
will be invoked. The Activity life cycle onResume
is called first retriving all data
Collection<Car> cars = storeApplication.getStore().readAll();