SlideShare a Scribd company logo
Parse
ymow
BaaS, backend as a service
BaaS is a model for providing web and mobile app developers
with a way to link their applications to backend cloud storage
and APIs exposed by back end applications while also
providing features such as user management, push
notifications, and integration with social networking services.
by wikipedia
Why parse.com
• clearly document
• simply operate
• synchronization automatic
• push notification server
• local data store
• open source
• Scale
第一次用Parse就深入淺出
第一次用Parse就深入淺出
第一次用Parse就深入淺出
第一次用Parse就深入淺出
第一次用Parse就深入淺出
• Download & unzip the SDK
• Add dependencies

dependencies {

compile 'com.parse.bolts:bolts-android:1.+'

compile fileTree(dir: 'libs', include: 'Parse-*.jar')}

• manifest

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
• Application#onCreate()

// Enable Local Datastore.

Parse.enableLocalDatastore(this);

Parse.initialize(this, "key", "key");
Quick Start
Basic Operate
• Saving Objects
• Retrieving Objects and Query data
• Updating Objects
• Arrays
• Deleting Objects
• ParseObject contains key-value pairs of JSON-compatible
data. This data is schemaless, which means that you don't
need to specify ahead of time what keys exist on each
ParseObject. You simply set whatever key-value pairs you
want, and our backend will store it.
ParseObject
ParseObject parseTest = new ParseObject("test");
parseTest("ClickNumber", “1”);
parseTest("cheatMode", “Anoymorus”);
String objectId = parseTest.getObjectId();
parseTest.saveInBackground();
saveParseObject
Retrieving Objects
ParseQuery<ParseObject> query =
ParseQuery.getQuery("test");
query.getInBackground("xWMyZ4YEGZ", new
GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (e == null) {
// object will be your game score
} else {
// something went wrong
}
}
});
ObjectID
ParseQuery<ParseObject> query =
ParseQuery.getQuery(“test");
query.whereEqualTo(“ClickNumber”,”1”);
query.getInBackground("xWMyZ4YEGZ", new
GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (e == null) {
// object will be your game score
} else {
// something went wrong
}
}
}); Query Objects
ParseQuery<ParseObject> query =
ParseQuery.getQuery("test");
query.getInBackground("xWMyZ4YEGZ", new
GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (e == null) {
// object will be your game score
object.put(“CkickNumber”,”2”);
object.saveInBackground();
} else {
// something went wrong
}
}
});
Updating Objects
JSONObject userProfile = new JSONObject();


ParseObject Androidhacker = new ParseObject("test");

Androidhacker.put("profile", userProfile);
Androidhacker.saveInBackground();
JSONObject
Array type
• To delete an object from the Parse Cloud

myObject.deleteInBackground();
• delete a single field from an object

// After this, the playerName field will be empty

myObject.remove("playerName");

// Saves the field deletion to the Parse Cloud

myObject.saveInBackground();

Delete Object
Member
• Sign up / Sign in
• Current User
• ParseFile(Image, File …etc)
• Anonymous Users
• Facebook Users
ParseUser.logInInBackground("RickisRich", "password", new
LogInCallback() {
public void done(ParseUser user, ParseException e) {
if (user != null) {
// Hooray! The user is logged in.
user.setUsername(“RickisGOD”)
user.saveInBackground();
} else {
// Signup failed. Look at the ParseException to see what
happened.
}
}
});
Sign in
ParseUser user = new ParseUser();
user.setUsername("my name");
user.setPassword("my pass");
user.setEmail("email@example.com");
// other fields can be set just like with ParseObject
user.put("phone", "650-253-0000");
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
// Hooray! Let them use the app now.
} else {
// Sign up didn't succeed. Look at the ParseException
// to figure out what went wrong
}
}
});
Sign up
ParseUser.getCurrentUser().setUsername(“RickisGod”);
ParseUser.getCurrentUser().saveInBackground();
ParseUser
ParseUser can be get or set in anywhere of the project, but
when you set anything, remember to saveInBackground, or
it will not be save.
ParseUser.getCurrentUser().getObjectId();

ParseUser.getCurrentUser().getEmail();
ParseFile FacebookProfilePicture = new
ParseFile("image.png", facebookByte.toByteArray());


ParseUser.getCurrentUser().put("image",
FacebookProfilePicture);

ParseUser.getCurrentUser().saveInBackground();
ParseFile
Getting started with ParseFile is easy. First, you'll need to
have the data in byte[] form and then create a ParseFile
with it. In this example, we'll just use a string:
ParseAnonymousUtils.logIn(new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (e != null) {
Log.d("MyApp", "Anonymous login failed.");
} else {
Log.d("MyApp", "Anonymous user logged in.");
}
}
});
An anonymous user is a user that can be created without a
username and password but still has all of the same
capabilities as any other ParseUser. After logging out, an
anonymous user is abandoned, and its data is no longer
accessible. No matter have Internet connection or not,
ParseAnonymous will never be null value.
ParseAnonymous
• Add ParseFacebookUtilsV4.jar to your project
• Application#onCreate()

ParseFacebookUtils.initialize(context);
• OnActivityResult

@Override

protected void onActivityResult(int requestCode, int
resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);

ParseFacebookUtils.onActivityResult(requestCode,
resultCode, data);
Parse Facebook
ParseFacebookUtils.logInWithReadPermissionsInBackground(
this, permissions, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
if (user == null) {
Log.d("MyApp", "Uh oh. The user cancelled the Facebook
login.");
} else if (user.isNew()) {
makeOpenGraphRequest();
Log.d("MyApp", "User signed up and logged in through
Facebook!");
} else {
makeOpenGraphRequest();
Log.d("MyApp", "User logged in through Facebook!");
}
}
}); Parse Facebook
• Application#onCreate() 

Parse.enableLocalDatastore();
• Parse Query

ParseQuery<ParseObject> query =
ParseQuery.getQuery(“test");
query.whereEqualTo(“ClickNumber”,”1”);
query.getInBackground("xWMyZ4YEGZ", new
GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (e == null) {
…
});
Local Data store
• saveInBackground() => saveEventually()
Online and offline
第一次用Parse就深入淺出
Write good queries, the Golden Rule:
Minimize search space
第一次用Parse就深入淺出
第一次用Parse就深入淺出
第一次用Parse就深入淺出
F8 2015 - Running at Scale on Parse
https://www.youtube.com/watch?v=3wFQiQXQbto

More Related Content

PPTX
Share pointtechies linqtosp-andsbs
PPTX
Sharepoint Saturday India Online best practice for developing share point sol...
PPTX
Intro to Parse
PPTX
Parse Advanced
PDF
Node.js and Parse
PDF
Building Android apps with Parse
PPT
Lewis Chiu Portfolio
PDF
Parse cloud code
Share pointtechies linqtosp-andsbs
Sharepoint Saturday India Online best practice for developing share point sol...
Intro to Parse
Parse Advanced
Node.js and Parse
Building Android apps with Parse
Lewis Chiu Portfolio
Parse cloud code

What's hot (20)

PDF
Developing iOS REST Applications
PPTX
Leveraging parse.com for Speedy Development
PDF
How to make workout app for watch os 2
PDF
Query service in vCloud Director
PDF
Making connected apps with BaaS (Droidcon Bangalore 2014)
PDF
Javascript Application Architecture with Backbone.JS
PPT
Backbone.js
PDF
Server Side Swift with Swag
PDF
Distributing information on iOS
PDF
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
DOC
Database c# connetion
PDF
Memory Management on iOS
PDF
Search APIs in Spotlight and Safari
PDF
Using OpenStack With Fog
ODP
Indexed db
PPTX
ADO.NETObjects
PDF
SOLID principles with Typescript examples
PPT
Ajax
PDF
Icinga2 api use cases
Developing iOS REST Applications
Leveraging parse.com for Speedy Development
How to make workout app for watch os 2
Query service in vCloud Director
Making connected apps with BaaS (Droidcon Bangalore 2014)
Javascript Application Architecture with Backbone.JS
Backbone.js
Server Side Swift with Swag
Distributing information on iOS
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Database c# connetion
Memory Management on iOS
Search APIs in Spotlight and Safari
Using OpenStack With Fog
Indexed db
ADO.NETObjects
SOLID principles with Typescript examples
Ajax
Icinga2 api use cases
Ad

Viewers also liked (6)

PDF
好設計不簡單 第三章
PDF
界面設計黑魔法 - The Dark Art of Interface Design @ RGBA 07
PDF
提高轉換率 – 令人心動的行為召喚設計 Hpx life 45
PDF
Mopcon find dog_2.net
PPTX
社群經營與行銷:打造網路品牌價值
PDF
Core Bluetooth and BLE 101
好設計不簡單 第三章
界面設計黑魔法 - The Dark Art of Interface Design @ RGBA 07
提高轉換率 – 令人心動的行為召喚設計 Hpx life 45
Mopcon find dog_2.net
社群經營與行銷:打造網路品牌價值
Core Bluetooth and BLE 101
Ad

Similar to 第一次用Parse就深入淺出 (20)

PDF
Parse London Meetup - Cloud Code Tips & Tricks
PPTX
Html indexed db
KEY
CouchDB on Android
PDF
Introduction to Spring Boot.pdf
PPTX
Parsing in ios to create an app
PDF
Taking Web Apps Offline
PPTX
Real World MVC
PDF
SwampDragon presentation: The Copenhagen Django Meetup Group
ZIP
Javascript Everywhere
PDF
3 Mobile App Dev Problems - Monospace
PDF
Painless Persistence in a Disconnected World
PPTX
Full Stack Development with Node.js and NoSQL
PPTX
Full stack development with node and NoSQL - All Things Open - October 2017
PPTX
Dev Jumpstart: Build Your First App with MongoDB
PDF
Softshake - Offline applications
PDF
AI: Mobile Apps That Understands Your Intention When You Typed
PDF
Secure Coding For Java - Une introduction
PDF
iOS App with Parse.com as RESTful Backend
PPTX
Cloudbase.io MoSync Reload Course
PDF
Building Applications Using Ajax
Parse London Meetup - Cloud Code Tips & Tricks
Html indexed db
CouchDB on Android
Introduction to Spring Boot.pdf
Parsing in ios to create an app
Taking Web Apps Offline
Real World MVC
SwampDragon presentation: The Copenhagen Django Meetup Group
Javascript Everywhere
3 Mobile App Dev Problems - Monospace
Painless Persistence in a Disconnected World
Full Stack Development with Node.js and NoSQL
Full stack development with node and NoSQL - All Things Open - October 2017
Dev Jumpstart: Build Your First App with MongoDB
Softshake - Offline applications
AI: Mobile Apps That Understands Your Intention When You Typed
Secure Coding For Java - Une introduction
iOS App with Parse.com as RESTful Backend
Cloudbase.io MoSync Reload Course
Building Applications Using Ajax

Recently uploaded (20)

PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
AutoCAD Professional Crack 2025 With License Key
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
17 Powerful Integrations Your Next-Gen MLM Software Needs
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Patient Appointment Booking in Odoo with online payment
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Design an Analysis of Algorithms I-SECS-1021-03
Nekopoi APK 2025 free lastest update
Computer Software and OS of computer science of grade 11.pptx
Advanced SystemCare Ultimate Crack + Portable (2025)
Digital Systems & Binary Numbers (comprehensive )
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Design an Analysis of Algorithms II-SECS-1021-03
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 41
AutoCAD Professional Crack 2025 With License Key
Operating system designcfffgfgggggggvggggggggg
Why Generative AI is the Future of Content, Code & Creativity?
wealthsignaloriginal-com-DS-text-... (1).pdf
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)

第一次用Parse就深入淺出

  • 2. BaaS, backend as a service BaaS is a model for providing web and mobile app developers with a way to link their applications to backend cloud storage and APIs exposed by back end applications while also providing features such as user management, push notifications, and integration with social networking services. by wikipedia
  • 3. Why parse.com • clearly document • simply operate • synchronization automatic • push notification server • local data store • open source • Scale
  • 9. • Download & unzip the SDK • Add dependencies
 dependencies {
 compile 'com.parse.bolts:bolts-android:1.+'
 compile fileTree(dir: 'libs', include: 'Parse-*.jar')}
 • manifest
 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> • Application#onCreate()
 // Enable Local Datastore.
 Parse.enableLocalDatastore(this);
 Parse.initialize(this, "key", "key"); Quick Start
  • 10. Basic Operate • Saving Objects • Retrieving Objects and Query data • Updating Objects • Arrays • Deleting Objects
  • 11. • ParseObject contains key-value pairs of JSON-compatible data. This data is schemaless, which means that you don't need to specify ahead of time what keys exist on each ParseObject. You simply set whatever key-value pairs you want, and our backend will store it. ParseObject
  • 12. ParseObject parseTest = new ParseObject("test"); parseTest("ClickNumber", “1”); parseTest("cheatMode", “Anoymorus”); String objectId = parseTest.getObjectId(); parseTest.saveInBackground(); saveParseObject
  • 13. Retrieving Objects ParseQuery<ParseObject> query = ParseQuery.getQuery("test"); query.getInBackground("xWMyZ4YEGZ", new GetCallback<ParseObject>() { public void done(ParseObject object, ParseException e) { if (e == null) { // object will be your game score } else { // something went wrong } } }); ObjectID
  • 14. ParseQuery<ParseObject> query = ParseQuery.getQuery(“test"); query.whereEqualTo(“ClickNumber”,”1”); query.getInBackground("xWMyZ4YEGZ", new GetCallback<ParseObject>() { public void done(ParseObject object, ParseException e) { if (e == null) { // object will be your game score } else { // something went wrong } } }); Query Objects
  • 15. ParseQuery<ParseObject> query = ParseQuery.getQuery("test"); query.getInBackground("xWMyZ4YEGZ", new GetCallback<ParseObject>() { public void done(ParseObject object, ParseException e) { if (e == null) { // object will be your game score object.put(“CkickNumber”,”2”); object.saveInBackground(); } else { // something went wrong } } }); Updating Objects
  • 16. JSONObject userProfile = new JSONObject(); 
 ParseObject Androidhacker = new ParseObject("test");
 Androidhacker.put("profile", userProfile); Androidhacker.saveInBackground(); JSONObject Array type
  • 17. • To delete an object from the Parse Cloud
 myObject.deleteInBackground(); • delete a single field from an object
 // After this, the playerName field will be empty
 myObject.remove("playerName");
 // Saves the field deletion to the Parse Cloud
 myObject.saveInBackground();
 Delete Object
  • 18. Member • Sign up / Sign in • Current User • ParseFile(Image, File …etc) • Anonymous Users • Facebook Users
  • 19. ParseUser.logInInBackground("RickisRich", "password", new LogInCallback() { public void done(ParseUser user, ParseException e) { if (user != null) { // Hooray! The user is logged in. user.setUsername(“RickisGOD”) user.saveInBackground(); } else { // Signup failed. Look at the ParseException to see what happened. } } }); Sign in
  • 20. ParseUser user = new ParseUser(); user.setUsername("my name"); user.setPassword("my pass"); user.setEmail("email@example.com"); // other fields can be set just like with ParseObject user.put("phone", "650-253-0000"); user.signUpInBackground(new SignUpCallback() { public void done(ParseException e) { if (e == null) { // Hooray! Let them use the app now. } else { // Sign up didn't succeed. Look at the ParseException // to figure out what went wrong } } }); Sign up
  • 21. ParseUser.getCurrentUser().setUsername(“RickisGod”); ParseUser.getCurrentUser().saveInBackground(); ParseUser ParseUser can be get or set in anywhere of the project, but when you set anything, remember to saveInBackground, or it will not be save. ParseUser.getCurrentUser().getObjectId();
 ParseUser.getCurrentUser().getEmail();
  • 22. ParseFile FacebookProfilePicture = new ParseFile("image.png", facebookByte.toByteArray()); 
 ParseUser.getCurrentUser().put("image", FacebookProfilePicture);
 ParseUser.getCurrentUser().saveInBackground(); ParseFile Getting started with ParseFile is easy. First, you'll need to have the data in byte[] form and then create a ParseFile with it. In this example, we'll just use a string:
  • 23. ParseAnonymousUtils.logIn(new LogInCallback() { @Override public void done(ParseUser user, ParseException e) { if (e != null) { Log.d("MyApp", "Anonymous login failed."); } else { Log.d("MyApp", "Anonymous user logged in."); } } }); An anonymous user is a user that can be created without a username and password but still has all of the same capabilities as any other ParseUser. After logging out, an anonymous user is abandoned, and its data is no longer accessible. No matter have Internet connection or not, ParseAnonymous will never be null value. ParseAnonymous
  • 24. • Add ParseFacebookUtilsV4.jar to your project • Application#onCreate()
 ParseFacebookUtils.initialize(context); • OnActivityResult
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
 super.onActivityResult(requestCode, resultCode, data);
 ParseFacebookUtils.onActivityResult(requestCode, resultCode, data); Parse Facebook
  • 25. ParseFacebookUtils.logInWithReadPermissionsInBackground( this, permissions, new LogInCallback() { @Override public void done(ParseUser user, ParseException err) { if (user == null) { Log.d("MyApp", "Uh oh. The user cancelled the Facebook login."); } else if (user.isNew()) { makeOpenGraphRequest(); Log.d("MyApp", "User signed up and logged in through Facebook!"); } else { makeOpenGraphRequest(); Log.d("MyApp", "User logged in through Facebook!"); } } }); Parse Facebook
  • 26. • Application#onCreate() 
 Parse.enableLocalDatastore(); • Parse Query
 ParseQuery<ParseObject> query = ParseQuery.getQuery(“test"); query.whereEqualTo(“ClickNumber”,”1”); query.getInBackground("xWMyZ4YEGZ", new GetCallback<ParseObject>() { public void done(ParseObject object, ParseException e) { if (e == null) { … }); Local Data store
  • 27. • saveInBackground() => saveEventually() Online and offline
  • 29. Write good queries, the Golden Rule: Minimize search space
  • 33. F8 2015 - Running at Scale on Parse https://www.youtube.com/watch?v=3wFQiQXQbto