developers Making Sticky Social Apps Bear Douglas and Christine Abernathy github: beardouglas, caabernathy @beardigsit @caabernathy Wednesday, May 29, 13
Code: Fetching a person’s list of friends using app String fqlQuery = "SELECT uid, name FROM user WHERE uid IN " + "(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25) AND is_app_user = 1"; Bundle params = new Bundle(); params.putString("q", fqlQuery); Request request = new Request(Session.getActiveSession(), "/fql", params, HttpMethod.GET, new Request.Callback() { Wednesday, May 29, 13
Code: Fetching a person’s list of friends using app String fqlQuery = "SELECT uid, name FROM user WHERE uid IN " + "(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25) AND is_app_user = 1"; Bundle params = new Bundle(); params.putString("q", fqlQuery); Request request = new Request(Session.getActiveSession(), "/fql", params, HttpMethod.GET, new Request.Callback() { @Override public void onCompleted(Response response) { // Get the array of data returned JSONArray dataArray = (JSONArray) response.getGraphObject().getProperty("data"); if (dataArray.length() > 0) { // Cast this into a defined interface representing the response GraphObjectList result = GraphObject.Factory.createList(dataArray, MyResult.class); requestOpenGraphData(result); } } }); Wednesday, May 29, 13
Code: Fetching a person’s list of friends using app request.executeAsync(); String fqlQuery = "SELECT uid, name FROM user WHERE uid IN " + "(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25) AND is_app_user = 1"; Bundle params = new Bundle(); params.putString("q", fqlQuery); Request request = new Request(Session.getActiveSession(), "/fql", params, HttpMethod.GET, new Request.Callback() { @Override public void onCompleted(Response response) { // Get the array of data returned JSONArray dataArray = (JSONArray) response.getGraphObject().getProperty("data"); if (dataArray.length() > 0) { // Cast this into a defined interface representing the response GraphObjectList result = GraphObject.Factory.createList(dataArray, MyResult.class); requestOpenGraphData(result); } } }); Wednesday, May 29, 13
Code: Reading Open Graph Data from a list of friends private void requestOpenGraphData(GraphObjectList friends) { RequestBatch requestBatch = new RequestBatch(); for (MyResult friend : friends) { Wednesday, May 29, 13
Code: Reading Open Graph Data from a list of friends private void requestOpenGraphData(GraphObjectList friends) { RequestBatch requestBatch = new RequestBatch(); for (MyResult friend : friends) { Request ogDataRequest = Request.newGraphPathRequest( Session.getActiveSession(), friend.getUid()+"/resourcebrowser:browse", new Request.Callback() { public void onCompleted(Response response) { FacebookRequestError error = response.getError(); if (error == null) { // Process the data for display } } }); requestBatch.add(ogDataRequest); Wednesday, May 29, 13
Code: Reading Open Graph Data from a list of friends } requestBatch.executeAsync(); } private void requestOpenGraphData(GraphObjectList friends) { RequestBatch requestBatch = new RequestBatch(); for (MyResult friend : friends) { Request ogDataRequest = Request.newGraphPathRequest( Session.getActiveSession(), friend.getUid()+"/resourcebrowser:browse", new Request.Callback() { public void onCompleted(Response response) { FacebookRequestError error = response.getError(); if (error == null) { // Process the data for display } } }); requestBatch.add(ogDataRequest); Wednesday, May 29, 13
Case study: TripAdvisor Average user engagement increased Users who connect through Facebook are x as likely to contribute content “Cities I’ve Visited” app saw x increase in monthly active users after adding Open Graph Wednesday, May 29, 13
Code: Creating the Story // Create a batch request RequestBatch requestBatch = new RequestBatch(); // Create object creation request Bundle objectParams = new Bundle(); JSONObject book = new JSONObject(); book.put("title", "A Game of Thrones"); // ... objectParams.putString("object", book.toString()); Request objectRequest = new Request(session,"me/objects/books.book", objectParams, HttpMethod.POST, null); objectRequest.setBatchEntryName("objectCreate"); requestBatch.add(objectRequest); Wednesday, May 29, 13
Code: Creating the Story // Create a batch request RequestBatch requestBatch = new RequestBatch(); // Create the publish action request Bundle actionParams = new Bundle(); actionParams.putString("book", "{result=objectCreate:$.id}"); Request actionRequest = new Request(session,"me/books.reads", actionParams, HttpMethod.POST, null); requestBatch.add(actionRequest); // Create object creation request Bundle objectParams = new Bundle(); JSONObject book = new JSONObject(); book.put("title", "A Game of Thrones"); // ... objectParams.putString("object", book.toString()); Request objectRequest = new Request(session,"me/objects/books.book", objectParams, HttpMethod.POST, null); objectRequest.setBatchEntryName("objectCreate"); requestBatch.add(objectRequest); Wednesday, May 29, 13
Code: Creating the Story // Execute the batch request requestBatch.executeAsync(); // Create a batch request RequestBatch requestBatch = new RequestBatch(); // Create the publish action request Bundle actionParams = new Bundle(); actionParams.putString("book", "{result=objectCreate:$.id}"); Request actionRequest = new Request(session,"me/books.reads", actionParams, HttpMethod.POST, null); requestBatch.add(actionRequest); // Create object creation request Bundle objectParams = new Bundle(); JSONObject book = new JSONObject(); book.put("title", "A Game of Thrones"); // ... objectParams.putString("object", book.toString()); Request objectRequest = new Request(session,"me/objects/books.book", objectParams, HttpMethod.POST, null); objectRequest.setBatchEntryName("objectCreate"); requestBatch.add(objectRequest); Wednesday, May 29, 13
Creating a Custom Story ▪ Model your data ▪ Set up your custom story ▪ Create test objects ▪ Publish test actions create a collage Wednesday, May 29, 13
Parse Lets You Focus on the Fun Stuff Database REST API REST Z Z Server + + + users + security Caching Networking + + The fun stuff! Wednesday, May 29, 13
Parse Lets You Focus on the Fun Stuff no no no no no yes! Database REST API REST Z Z Server + + + users + security Caching Networking + + The fun stuff! Z Wednesday, May 29, 13
Querying Data ParseQuery query = new ParseQuery("Score");; query.whereEqualTo("playerName", "Christine Abernathy"]; query.whereGreaterThan("points", 10000]; query.findInBackground(new FindCallback() { public void done(List pointList, ParseException e) { // Process the result } }); Wednesday, May 29, 13
Pro Tips ▪Track content performance through Insights ▪Generate image rich stories ▪Use proper Open Graph tags for great previews ▪Consider adding Internationalization support Wednesday, May 29, 13
Case study: Waze Wazers who use Facebook drive more miles Users who connect through Facebook use Waze . x as often as other users User growth doubled after adding Facebook Login How can a mapping app be social? Enable friends to carpool and share directions to events Wednesday, May 29, 13
Your Cross-Platform Checklist Use the same Facebook App ID everywhere Enable Deep Linking for Android and iOS Implement Facebook Login on every platform Wednesday, May 29, 13
Your Cross-Platform Checklist Use the same Facebook App ID everywhere Enable Deep Linking for Android and iOS Make it easy to share from every platform Implement Facebook Login on every platform Wednesday, May 29, 13
Best Practices ▪ Real People. Real Things. ▪ Strong Call to Action ▪ Include Mobile Devices ▪ App Screenshots ▪ Test. Test. Test. Wednesday, May 29, 13
Key Takeaways ▪Pay attention to your user’s lifecycle ▪Show engaging content first ▪Use Open Graph to tell rich stories ▪Add cross-platform support Wednesday, May 29, 13
Key Takeaways ▪Pay attention to your user’s lifecycle ▪Show engaging content first ▪Use Open Graph to tell rich stories ▪Add cross-platform support ▪A/B test content and ads to find the most effective ways to get users Wednesday, May 29, 13