SlideShare a Scribd company logo
1 of 33
Download to read offline
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
• 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
Write good queries, the Golden Rule:
Minimize search space
F8 2015 - Running at Scale on Parse
https://www.youtube.com/watch?v=3wFQiQXQbto

More Related Content

What's hot

Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applicationslmrei
 
Leveraging parse.com for Speedy Development
Leveraging parse.com for Speedy DevelopmentLeveraging parse.com for Speedy Development
Leveraging parse.com for Speedy DevelopmentAndrew Kozlik
 
How to make workout app for watch os 2
How to make workout app for watch os 2How to make workout app for watch os 2
How to make workout app for watch os 2Yusuke Kita
 
Query service in vCloud Director
Query service in vCloud DirectorQuery service in vCloud Director
Query service in vCloud DirectorMayank Goyal
 
Making connected apps with BaaS (Droidcon Bangalore 2014)
Making connected apps with BaaS (Droidcon Bangalore 2014)Making connected apps with BaaS (Droidcon Bangalore 2014)
Making connected apps with BaaS (Droidcon Bangalore 2014)Varun Torka
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSMin Ming Lo
 
Server Side Swift with Swag
Server Side Swift with SwagServer Side Swift with Swag
Server Side Swift with SwagJens Ravens
 
Distributing information on iOS
Distributing information on iOSDistributing information on iOS
Distributing information on iOSMake School
 
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Ryosuke Uchitate
 
Memory Management on iOS
Memory Management on iOSMemory Management on iOS
Memory Management on iOSMake School
 
Search APIs in Spotlight and Safari
Search APIs in Spotlight and SafariSearch APIs in Spotlight and Safari
Search APIs in Spotlight and SafariYusuke Kita
 
Using OpenStack With Fog
Using OpenStack With FogUsing OpenStack With Fog
Using OpenStack With FogMike Hagedorn
 
SOLID principles with Typescript examples
SOLID principles with Typescript examplesSOLID principles with Typescript examples
SOLID principles with Typescript examplesAndrew Nester
 
Icinga2 api use cases
Icinga2 api use casesIcinga2 api use cases
Icinga2 api use casesroy peter
 

What's hot (20)

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

Viewers also liked

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

Viewers also liked (6)

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

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

Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksHector Ramos
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
Introduction to Spring Boot.pdf
Introduction to Spring Boot.pdfIntroduction to Spring Boot.pdf
Introduction to Spring Boot.pdfShaiAlmog1
 
Parsing in ios to create an app
Parsing in ios to create an appParsing in ios to create an app
Parsing in ios to create an appHeaderLabs .
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps OfflinePedro Morais
 
SwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupSwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupErnest Jumbe
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript EverywherePascal Rettig
 
3 Mobile App Dev Problems - Monospace
3 Mobile App Dev Problems - Monospace3 Mobile App Dev Problems - Monospace
3 Mobile App Dev Problems - MonospaceFrank Krueger
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldChristian Melchior
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
Full Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQLFull Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQLAll Things Open
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBMongoDB
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applicationsjeromevdl
 
AI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedAI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedMarvin Heng
 
Secure Coding For Java - Une introduction
Secure Coding For Java - Une introductionSecure Coding For Java - Une introduction
Secure Coding For Java - Une introductionSebastien Gioria
 
iOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendiOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendStefano Zanetti
 
Cloudbase.io MoSync Reload Course
Cloudbase.io MoSync Reload CourseCloudbase.io MoSync Reload Course
Cloudbase.io MoSync Reload Coursecloudbase.io
 
Building Applications Using Ajax
Building Applications Using AjaxBuilding Applications Using Ajax
Building Applications Using Ajaxs_pradeep
 

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

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

Recently uploaded

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 

Recently uploaded (20)

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

第一次用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
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 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
  • 28.
  • 29. Write good queries, the Golden Rule: Minimize search space
  • 30.
  • 31.
  • 32.
  • 33. F8 2015 - Running at Scale on Parse https://www.youtube.com/watch?v=3wFQiQXQbto