playing with parse.com
TRANSCRIPT
![Page 1: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/1.jpg)
Playing with parse.comBuilding an app called Qoffee
Andrea De Gaetano
My Blog: http://pestohacks.blogspot.com
Twitter: @dega1999
the app: www.qoffee.it
Interests: #mobile #security #linux #robots #drones #parkour #ara
![Page 2: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/2.jpg)
What is Parse?Backend as a service
Bought in 2013 by Facebook
SDK for all the major client platforms: android, ios, windows, unity3d, php, iot… blablabla!
Useful to build multi-platform apps
Simplify APP development
“””Free”””(*)
Made with Go (previously ruby), C++, Javascript
![Page 3: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/3.jpg)
What is Qoffee?My side project
An app that helps people to
find the best coffee in town
keep track of Coffee consumption
With Achievements
Test Parse.com is one of the reason behind this app
The app is available on Play Store and Amazon App Store
https://play.google.com/store/apps/details?id=com.andrea.degaetano.coffelover
![Page 4: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/4.jpg)
What we will see:
Platform Tools Overview
Getting started on Android
Build a Multiple-Login screen
Fetch Cloud Data from your Android App
Build API with Cloud Code
Schedule Tasks
![Page 5: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/5.jpg)
Testo
Platform Tools
![Page 6: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/6.jpg)
Android: Getting Started
Create an account
Create an App on parse.com
Get App keys (in settings)
Download the template APP
Import the project in Android Studio
You need to create Facebook and Twitter App to use “social” login
Template: https://github.com/ParsePlatform/ParseUI-Android
![Page 7: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/7.jpg)
Social-Login ScreenSpecify the following in res/values/strings.xml of each sample project:
parse_app_id and parse_client_key
facebook_app_id
twitter_consumer_key and twitter_consumer_secret
Your users will be recorded in a “User” table on Cloud Data
New User creation is already implemented
Email password recovery is already implemented (customizable)
![Page 8: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/8.jpg)
Login Screenshots
https://github.com/ParsePlatform/ParseUI-Android
![Page 9: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/9.jpg)
Connect with Parse Cloud
ParseObject is the class representing a single row in a table in the cloud:
You can pass any supported cloud data type: number, binary files, coordinates, string…
You can view the created data on your parse page
![Page 10: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/10.jpg)
Connect with Parse CloudParseQuery is the class to retrieve data from the cloud:
You can add constraint with where clause to ParseQuery like: • whereGreaterThan(String key, Object value) • whereExists(String key) • whereStartsWith(String key, String prefix) • whereWithinKilometers(String k, ParseGeoPoint p, double maxDistance) • whereEqualTo(String key, Object value)
![Page 11: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/11.jpg)
ListView —> ParseQueryAdapter
To display a list of objects you can: build your own adapter and use ParseQuery use the ParseQueryAdapter
ParseQueryAdapter paginate results by default You can customize the layout
![Page 12: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/12.jpg)
Cloud CodeAll the advantages of the service side code:
expose API
simplify multiplatform support
change app behavior anytime
validate pre and post data creation:
BeforeSave(object): 3 secs timeout
AfterSave (object): 3 secs timeout
The language is Javascript: based on backbone.js
Function should finish in 15 seconds.
![Page 13: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/13.jpg)
Cloud Code: function example
![Page 14: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/14.jpg)
Cloud Code: beforesave example
![Page 15: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/15.jpg)
Cloud CodeParseQuery typical function used:
first: retrieve the first object of a query
each: call a callback for each found record
find: list of objects that satisfies the query
…
Query are limited to a max of 1000 results (default is 100)
More requests you do —> More money you need!
![Page 16: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/16.jpg)
Cloud CodeYou use a terminal tool to upload new code: parse deploy
You can chain multiple operations with Promise
Hard to debug -> upload code, run and watch the results on the log
At least there’s a static analyzer checker
You can add external javascript library to your project:
underscore.js
sax.js
xmlreader.js
never work out of the box! :D
![Page 17: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/17.jpg)
Cloud Code: tool
![Page 18: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/18.jpg)
Schedule TaskThe code is similar to cloud code, except for the functions declaration
Necessary for long running task
The job functions require to return status.success o status.error
You need to register the task with the platform
Debug —> Log
![Page 19: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/19.jpg)
Schedule Task: configuration
![Page 20: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/20.jpg)
Schedule Task: rss parsing example
![Page 21: Playing with parse.com](https://reader031.vdocument.in/reader031/viewer/2022030300/58812fea1a28ab00438b6575/html5/thumbnails/21.jpg)
Thanks you!
Andrea De Gaetano
My Blog: http://pestohacks.blogspot.com
Twitter: @dega1999
the app: www.qoffee.it
Interests: #mobile #security #linux #robots #drones #parkour #ara