Persistence in Mobile Android iOS SQLite android.database.sqlite Tables and relations Core Data Objects DataModel Content Providers /data/data/<Application-Package> /databases/<database-name> Only acces with root DataModel editor in Xcode for register objects and their relationships
Persistence in Mobile public class Event extends Entity { public int id; public String name; } Event e = Entity.query(Event.class).where("id=1") .execute(); p.name = “Techfest"; p.save();
MBaaS features API REST for CRUD operations(GET,POST,UPDATE,DELETE,PATCH) Multi platform SDK Cloud Storage Push notifications User management Data Browser Query language Import/Export data Analytics / Monetization
MBaaS features Reduce server side coding developers can focus on front-end development often providers offer SDKs that wrap REST API calls and handle in/out parameters: both HTML/JS and native (iOS, Android,Windows Phone) No server setup, ready to use (HOSTED SERVICE) Deployed on the cloud, with built-in scalability
Push Notifications Multiplatforms messages Enable server applications to send information to mobile apps even when the app isn’t in use The device displays the information using a “badge,” alert, or pop up message. A push notification uses the service provided by the device’s operating system: iOS - Apple Push Notification service (APNS) Android - Google Cloud Messaging (GCM)
Push Notifications iOS Apple Push Notification service (APNs) Certificate Private Key Android Google Cloud Messaging API KEY Sender ID Google API Console > Authentication && Project Number
Kinvey Data collection Kinvey stores data as collections and entities. Entities are JSON documents. Collections belong to applications. Internally, data is stored in a MongoDB cluster.
Parse Objects Parse stores data internally as flat JSON Documents, called ParseObject, with have the restriction that keys must be alphanumeric strings. Parse automatically creates ‘classes’ for ParseObjects, grouping objects with similar properties. Classes and all objects associated to them belong to applications, which can be defined on the Parse web interface. ParseObject event = new ParseObject(“Event"); event.put(“eventName", “techfest”); event.put(“eventURL", “http://techfest.uc3m.es"); event.put(“eventDate", new Date());
CACHE query.cachePolicy property CachePolicy.CACHE_ELSE_NETWORK The query first tries to load from the cache, but if that fails, it loads results from the network.If neither cache nor network succeed, there is a PFError. CachePolicy.CACHE_THEN_NETWORK The query first loads from the cache, then loads from the network. In this case, the callback will actually be called twice - first with the cached results, then with the network results. Since it returns two results at different times, this cache policy cannot be used synchronously with findObjects.
PARSE USER MANAGMENT //login ParseUser.logInInBackground(username, password, new LogInCallback() { public void done(ParseUser user, com.parse.ParseException e) { }}); //signUp ParseUser user = new ParseUser(); user.setUsername(username); user.setPassword(password); user.setEmail(email); //optional user.signUpInBackground(new SignUpCallback() { public void done(com.parse.ParseException e) { }}); //Check if user is logged ParseUser currentUser = ParseUser.getCurrentUser();