18
Parse A mobile backend platform www.parse.com Carlotta Tatti Twitter: @thestubborndev Email: [email protected]

Parse - a mobile backend platform

Embed Size (px)

Citation preview

Page 1: Parse - a mobile backend platform

ParseA mobile backend platform

www.parse.com

Carlotta TattiTwitter: @thestubborndev

Email: [email protected]

Page 2: Parse - a mobile backend platform

Cosa offre Parse?

• Una soluzione integrata per la creazione di backend

• SDK per Android, iOS, Javascript, Unity 3D, Windows 8, Windows Phone

• Endpoint REST

Page 3: Parse - a mobile backend platform

Parse Data

Page 4: Parse - a mobile backend platform

Creazione di un elementoParseObject gameScore = new ParseObject("GameScore");gameScore.put("score", 1337);gameScore.put("playerName", "Sean Plott");gameScore.put("cheatMode", false);gameScore.saveInBackground();

[Parse setApplicationId:@"APPLICATION_ID" clientKey:@"CLIENT_KEY"];

Inizializzazione dell’SDK

Page 5: Parse - a mobile backend platform

Creazione di un utenteParseUser user = new ParseUser();user.setUsername("my name");user.setPassword("my pass");user.setEmail("[email protected]"); // other fields can be set just like with ParseObjectuser.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    }  }});

Page 6: Parse - a mobile backend platform

QueryParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore");query.whereEqualTo("playerName", "Dan Stemkoski");query.findInBackground(new FindCallback<ParseObject>() {    public void done(List<ParseObject> scoreList, ParseException e) {        if (e == null) {            Log.d("score", "Retrieved " + scoreList.size() + " scores");        } else {            Log.d("score", "Error: " + e.getMessage());        }    }});

Page 7: Parse - a mobile backend platform

Parse Push

Page 8: Parse - a mobile backend platform

Push Notifications

• Dashboard web per spedire Push Notification

• Targeting dei destinatari

• Pianificazione oraria

Page 9: Parse - a mobile backend platform

Send a Push NotificationParsePush push = new ParsePush();push.setChannel("Giants");push.setMessage("The Giants just scored! It's now 2-2 against the Mets.");push.sendInBackground();

// Create our Installation queryParseQuery pushQuery = ParseInstallation.getQuery();pushQuery.whereEqualTo("injuryReports", true); // Send push notification to queryParsePush push = new ParsePush();push.setQuery(pushQuery); // Set our Installation querypush.setMessage("Willie Hayes injured by own pop fly.");push.sendInBackground();

Esempio 2

Esempio 1

Page 10: Parse - a mobile backend platform

Parse Social

Page 11: Parse - a mobile backend platform

Parse Social

• Signup tradizionale (username e password)

• Signup tramite Twitter o Facebook

• Gestione di tutto ciò che riguarda l’autenticazione e la gestione degli utenti (login, logout, password reset, email di conferma etc..)

Page 12: Parse - a mobile backend platform

Login with FacebookParseFacebookUtils.initialize("YOUR FACEBOOK APP ID");

@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {  super.onActivityResult(requestCode, resultCode, data);  ParseFacebookUtils.finishAuthentication(requestCode, resultCode, data);}

1.

2.

continua...

Page 13: Parse - a mobile backend platform

Login with FacebookParseFacebookUtils.logIn(this, 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()) {      Log.d("MyApp", "User signed up and logged in through Facebook!");    } else {      Log.d("MyApp", "User logged in through Facebook!");    }  }});

3.

Page 14: Parse - a mobile backend platform

Login with Facebook

L’utente corrente è sempre accessibile:

ParseUser currentUser = ParseUser.getCurrentUser();if (currentUser != null) {  // do stuff with the user} else {  // show the signup or login screen}

Page 15: Parse - a mobile backend platform

Cloud Code

Page 16: Parse - a mobile backend platform

Cloud Code

• Codice server-side in Javascript

• Estensibile tramite moduli

• Possibilità di pianificare task periodici

Page 17: Parse - a mobile backend platform

Una funzione Cloud Code

Parse.Cloud.define("hello", function(request, response) {  response.success("Hello world!");});

Javascript

ParseCloud.callFunctionInBackground("hello", new HashMap<String, Object>(), new FunctionCallback<String>() {  void done(String result, ParseException e) {    if (e == null) {      // result is "Hello world!"    }  }});

Android

Page 18: Parse - a mobile backend platform

Pricing