36
Google confidential Do not distribute Google confidential Do not distribute Building mobile app backend with Google Cloud Platform Dmitry Nefedkin Google Cloud Platform Solutions Engineer Natalia Efimtseva Developer Relations Program Manager

Mobile backends with Google Cloud Platform (MBLTDev'14)

Embed Size (px)

Citation preview

Page 1: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Google confidential │ Do not distribute

Building mobile app backendwith Google Cloud PlatformDmitry NefedkinGoogle Cloud Platform Solutions Engineer

Natalia Efimtseva Developer Relations Program Manager

Page 2: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Agenda

Google Cloud Platform - why should I care?

“API-first” backend development with Google Cloud endpoints

“Frontend-first” approach and how Firebase can help

1

2

3

Page 3: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Agenda

Google Cloud Platform - why should I care?

“API-first” backend development with Google Cloud endpoints

“Frontend-first” approach and how Firebase can help

1

2

3

Page 4: Mobile backends with Google Cloud Platform (MBLTDev'14)

Source: http://blogs.telerik.com/platform/posts/14-05-13/introducing-telerik-platform-developer-edition-for-just-$39-monthSource: Developer Economics Q3 2014: State of the Developer Nation

`

2.9Mmobile developers worldwide

Page 5: Mobile backends with Google Cloud Platform (MBLTDev'14)

2Mapps alreadydeveloped

Source: http://fraudforthought.com/index.php/its-an-apps-world/Source: Developer Economics Q3 2014: State of the Developer Nation

Page 6: Mobile backends with Google Cloud Platform (MBLTDev'14)

Source: http://41mag.fr/wp-content/themes/channel/images/menuHtml5.pngSource: Developer Economics Q3 2014: State of the Developer Nation

HTML5 is used by

42%of developers as a technology for app development

Page 7: Mobile backends with Google Cloud Platform (MBLTDev'14)

Developers target

2.2platform on average

Source: http://www.techtimes.com/articles/13106/20140815/android-ios-combined-market-share-swells-leaving-2-5-percent-for-windows-phone.htmSource: Developer Economics Q3 2014: State of the Developer Nation

Page 8: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

For the past 15 years, Google has been building out the world’s fastest, most powerful, highest quality cloud infrastructure on the planet.

Images by Connie Zhou

Page 9: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

A Network that Spans the Globe

Page 10: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

A Network that Spans the Globe

Page 11: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Continue to Innovate & Improve our Tooling

SpannerDremelMapReduce

Big Table ColossusCompute

Engine

2012 2014+2002 2004 2006 2008 2010

GFS

2013

More!

Page 12: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Storage

Cloud Storage Cloud SQL Cloud Datastore

Compute

Compute EngineApp Engine

App Services

BigQuery Cloud Endpoints

Google Cloud Platform

Page 13: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Mobile Gaming Storage

Big Data Highly Scalable Apps Digital Marketing

Yes, We Can Power That

Page 14: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Agenda

Google Cloud Platform - why should I care?

“API-first” backend development with Google Cloud endpoints

“Frontend-first” approach and how Firebase can help

1

2

3

Page 15: Mobile backends with Google Cloud Platform (MBLTDev'14)

API-First development: What & Why

Image from “How API-First Development Boosts Productivity”full story - http://goo.gl/o3WBIq

What:every piece of shared functionality for your organization it should be exposed as a RESTful HTTP API to all of your other developers

Why:● Enforcing separation of

concerns;● Hiding complexity

“API Economy” is coming

Page 16: Mobile backends with Google Cloud Platform (MBLTDev'14)

Pretty old & well-deserved Horse...

Image source: http://www.ehow.com/way_5475563_feed-three-year-old-horse.html

Page 17: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google App Engine: easy to build, scale, maintain

● Java, Python, PHP, Go Support

● Rapid application development

● Scale infinitely

● Replicated data storage

● Versioning and Traffic Splitting

● Familiar development tools

Page 18: Mobile backends with Google Cloud Platform (MBLTDev'14)

… but with the new carriage

Image source: http://www.today.com/news/history-wheels-5-things-know-about-queens-new-carriage-2D79756846

Page 19: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google Cloud Endpoints

Extremely simple way to expose server side logic on full power, management free Google App Engine platform

• Uses App Engine’s auto-scaling and high-availability

• Exposes standards based REST interfaces with built-in authorization

• Auto-generates strongly typed, mobile optimized client libraries for Android, iOS and web.

• Makes you more productive!

Page 20: Mobile backends with Google Cloud Platform (MBLTDev'14)

Taking the plumbing out of API programming

Mobile Backend Running on Google App Engine Instances

Mobile Backend Running on Google App Engine Instances

Mobile Backend Running on Google App Engine Instances

Cloud Endpoints

Clients

Page 21: Mobile backends with Google Cloud Platform (MBLTDev'14)

Android Studio + Cloud Endpoints

Easiest way for mobile developers to connect to Google Cloud Platform

• Create Google App Engine backends in Android Studio

• Generate Java-specific bindings for use in Android app

• Benefit from as-you-type validations and quick-fixes when defining the backend API

• Use App Engine-specific Gradle tooling that allows for a unified client/backend build

Page 22: Mobile backends with Google Cloud Platform (MBLTDev'14)

Call Cloud Endpoints API from iOS

● Generate RPC Discovery documents in AndroidStudio using

appengineEndpointsGetDiscoveryDocs Gradle task

● Download and build ServiceGenerator

● Use ServiceGenerator command line utility to generate Objective-C code from

RPC Discovery document

● Include generated Objective-C files to your XCode project

● Add code to call Cloud Endpoints API from the UI of the app

For more info: http://goo.gl/JhdaVW

Page 23: Mobile backends with Google Cloud Platform (MBLTDev'14)

Call Cloud Endpoints API from Javascript

• Use the Google Javascript Client Library

<script src="https://apis.google.com/js/client.js?onload=init"></script>

• Load the endpoint

var ROOT = 'https://your_app_id.appspot.com/_ah/api';

gapi.client.load('your_api_name', 'v1', function() { doSomethingAfterLoading();}, ROOT);

• Use the endpoint:gapi.client.tictactoe.scores.insert({'outcome':

'WON'}).execute(function(resp) {

console.log(resp);

});

More info: http://goo.gl/5ynKEb

Page 24: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential | Do not distribute

Demo: a case management app for mobile workers

Page 25: Mobile backends with Google Cloud Platform (MBLTDev'14)

getTask().execute()

Cloud Datastore

App Engine backend

Clou

d En

dpoi

nts

Cases app

Clie

nt L

ibra

ries

Demo Architecture

pullFromRemote

pushToRemotestoreTask().execute()

query.get() transaction.commit()

Chrome Mgmt Extension

getAllCases().execute()

updateCases().execute()

Java

scri

pt L

ibra

ries

Cloud Endpoints Tutorial for Android: github.com/GoogleCloudPlatform/endpoints-codelab-android

Page 26: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential | Do not distribute

● Delivers > 700 million photos &

videos per day (May, 2014)

● Heavy user of App Engine services

● 3 M DAU

● Started to use Compute Engine for

some services

Snapchat

Page 27: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential | Do not distribute

● Angry Birds for Chrome, FB

● Using the Datastore to store game data

● Memcache API

● Task Queues for Background Operations

● Users API for Authentication

Rovio

Page 28: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential | Do not distribute

● SongPop - “guess a song

application”

● Serves 18TB a day with 80

million users

● Fetching media from Google

Cloud Storage

● Just 3-4 developers per

project

FreshPlanet

Page 29: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Ok, I wanna try!

cloud.google.com/free-trial● 300$ - Google Cloud Platform Credits● 60 days● all products (max 2 concurrent cores for

Google Compute Engine) ● still have to enter credit card details

during the registration

Page 30: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Agenda

Google Cloud Platform - why should I care?

“API-first” backend development with Google Cloud endpoints

“Frontend-first” approach and how Firebase can help

1

2

3

Page 31: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

API-first is cool but...

● we do not have dedicated

backend developers;

● we want to prototype quickly;

● we just need to store the data

and sync them between the

connected clients;

● we need offline support;

Image source: https://beingsakin.files.wordpress.com/2011/11/yesbut.jpg

Page 32: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Firebase

“Over the past three years, we’ve gone from a crazy idea that ‘just might work’ to a proven product used by 110,000 developers. Today, I couldn’t be happier to announce that we’ve joined Google.”

Page 33: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Firebase

● Server and NoSQL database to interact with through API calls

● Sync data from multiple applications● Simple Login Service with several

types of built-in authentication● Security: SSL encryption & security

rules● Support offline mode

Page 34: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Firebase Forge

The Firebase Forge provides a convenient GUI for visualizing and manipulating your data in real-time.

Page 35: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

Firebase demo: image drawing application

https://github.com/Dnefedkin/Firebase-Drawing-Demo-Android

Page 36: Mobile backends with Google Cloud Platform (MBLTDev'14)

Google confidential │ Do not distribute

cloud.google.com

Dmitry Nefedkin ([email protected])Google Cloud Platform Solutions Engineer

Natalia Efimtseva ([email protected])Developer Relations Program Manager

Images by Connie Zhou