Top Banner
+Nelson Glauber @nglauber www.nglauber.com.br Google Play Services! ROCKS!!!
49

Google Play Services Rocks!!!

Jan 06, 2017

Download

Mobile

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Google Play Services Rocks!!!

+Nelson Glauber@nglauber www.nglauber.com.br

Google Play Services! ROCKS!!!

Page 2: Google Play Services Rocks!!!

@nglauber

+NelsonGlauber

www.nglauber.com.br

Page 3: Google Play Services Rocks!!!

Visão geral• Com o Google Play Services, sua app pode utilizar os

serviços do Google como Mapas, Google+, Drive, e muito mais.

• Tudo isso com atualização automática via Google Play por meio de um simples APK. (5 versões só em 2015)

• Isso torna mais ágil para os usuários receberem atualizações de serviços do Google e fácil para o desenvolvedor em integra-las ao seu app!

• Tudo isso compatível com Android 2.3 (API Level 9) ou superior.

Page 4: Google Play Services Rocks!!!

BUILD

+MagnusHyttsen

BETTERAPPS!!!

Google Play Services allows you to…

Page 5: Google Play Services Rocks!!!

Arquitetura

Page 6: Google Play Services Rocks!!!

Setup

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.google.gms:google-services:1.4.0-beta3' } }

Page 7: Google Play Services Rocks!!!

Setup

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services'

...

dependencies { compile 'com.google.android.gms:play-<API>:8.1.+' }

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

Page 8: Google Play Services Rocks!!!

https://developers.google.com/mobile/add?platform=android

Page 9: Google Play Services Rocks!!!
Page 10: Google Play Services Rocks!!!
Page 11: Google Play Services Rocks!!!

Áreas

✓ Desenvolvimento

- Usando as APIs disponíveis

✓ Engajamento

- Mais de um 1 Bilhão de aparelhos

✓ Rentabilidade

- Em 2015, mais de 7 Bilhões de dólares pagos aos desenvolvedores.

Page 12: Google Play Services Rocks!!!

Desenvolvimento

Page 13: Google Play Services Rocks!!!

Analytics

Page 14: Google Play Services Rocks!!!

Analytics

compile 'com.google.android.gms:play-services-analytics:8.1.0'

GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); Tracker mTracker = analytics.newTracker(R.xml.global_tracker); mTracker.send(new HitBuilders.EventBuilder() .setCategory("Ação") .setAction("Compartilhar") .build()); mTracker.setScreenName("TelaPrincipal"); mTracker.send(new HitBuilders.ScreenViewBuilder().build());

Page 15: Google Play Services Rocks!!!

Login e senha pls!

Page 16: Google Play Services Rocks!!!

Google Sign in

Page 17: Google Play Services Rocks!!!

Google Sign in

compile 'com.google.android.gms:play-services-plus:8.1.0'

GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(new Scope(Scopes.PROFILE)) .addScope(new Scope(Scopes.EMAIL)) .build(); mGoogleApiClient.connect();

Page 18: Google Play Services Rocks!!!

Mapas e Localização

• Diferentes visualizações

• Marcadores customizados

• Polylines + Directions

• Geofencing

• Fused Location

Page 19: Google Play Services Rocks!!!

Places

Place Picker Add places / photos Place autocomplete

Current Place

Page 20: Google Play Services Rocks!!!

Places

GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Places.GEO_DATA_API) .addApi(Places.PLACE_DETECTION_API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); mGoogleApiClient.connect();

compile "com.google.android.gms:play-services-location:8.1.0"

Page 21: Google Play Services Rocks!!!

Places

PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, null); result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() { @Override public void onResult(PlaceLikelihoodBuffer likelyPlaces) { for (PlaceLikelihood placeLikelihood : likelyPlaces) { Log.i(TAG, String.format("Place '%s' has likelihood: %g", placeLikelihood.getPlace().getName(), placeLikelihood.getLikelihood())); } likelyPlaces.release(); } });

Page 22: Google Play Services Rocks!!!

PlacesPlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder(); Intent intent = intentBuilder.build(getActivity()); startActivityForResult(intent, REQUEST_PLACE_PICKER);

@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_PLACE_PICKER && resultCode == Activity.RESULT_OK) { final Place place = PlacePicker.getPlace(data, getActivity());

final CharSequence name = place.getName(); final CharSequence address = place.getAddress(); final CharSequence phone = place.getPhoneNumber(); final String placeId = place.getId(); ...

Page 23: Google Play Services Rocks!!!

Engajamento

Page 24: Google Play Services Rocks!!!

Google Cloud Messaging

Page 25: Google Play Services Rocks!!!

Google Cloud Messaging

1. registrar

2. enviar chave para o servidor

a. envia uma mensagem

b. mensagementregue

Page 26: Google Play Services Rocks!!!

App Indexing & Deep Linking

Page 27: Google Play Services Rocks!!!

App Install Ads

• Estratégia do AdWords para divulgar seu aplicativo.

• Dentro de outros aplicativos

• Resultado de buscas

• Vídeo no YouTube

Page 28: Google Play Services Rocks!!!

App Invites

Page 29: Google Play Services Rocks!!!

private void onInviteClicked() { Intent intent = new AppInviteInvitation.IntentBuilder("Título") .setMessage("Mensagem") .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link))) .setCustomImage(Uri.parse("http://example.com/imagem.jpg")) .setCallToActionText("Install!!!") .build(); startActivityForResult(intent, REQUEST_INVITE); }

@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_INVITE) { if (resultCode == RESULT_OK) { String[] ids = AppInviteInvitation.getInvitationIds(resultCode, data); ... } } }

Page 30: Google Play Services Rocks!!!

Rentabilidade

Page 31: Google Play Services Rocks!!!

AdMob

<com.google.android.gms.ads.AdView android:id="@+id/adView" … ads:adSize="BANNER" ads:adUnitId="@string/test_banner_ad_unit_id"/>

AdView mAdView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest);

compile 'com.google.android.gms:play-services-ads:8.1.0'

Page 32: Google Play Services Rocks!!!

AdMob

InterstitialAd mInterstitialAd = new InterstitialAd(this); mInterstitialAd.setAdUnitId( getString(R.string.test_interstitial_ad_unit_id)); AdRequest adRequest = new AdRequest.Builder().build(); mInterstitialAd.loadAd(adRequest); if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); }

Page 33: Google Play Services Rocks!!!

In-App Billing

• Venda de produtos (não físicos)

• Administração de produtos

• Assinaturas

• 70% do valor vendido é seu!

Page 34: Google Play Services Rocks!!!

Android pay

Page 35: Google Play Services Rocks!!!

Acabou???

Page 36: Google Play Services Rocks!!!
Page 37: Google Play Services Rocks!!!

Mobile Vision

Page 38: Google Play Services Rocks!!!

Mobile Vision

• getIsLeftEyeOpenProbability()getIsRighteyeOpenProbability()Retorna um valor entre 0 e 1 dando a probabilidade de olho esquerdo estar aberto.

• getIsSmilingProbability()Retorna um valor entre 0 e 1 com a probabilidade de estar sorrindo.

Page 39: Google Play Services Rocks!!!

Mobile VisionFaceDetector faceDetector = new FaceDetector.Builder(getApplicationContext()) .setTrackingEnabled(false) .build(); if(faceDetector.isOperational()){ Frame frame = new Frame.Builder().setBitmap(myBitmap).build(); SparseArray<Face> faces = faceDetector.detect(frame);

for(int i=0; i<faces.size(); i++) { Face thisFace = faces.valueAt(i); float x1 = thisFace.getPosition().x; float y1 = thisFace.getPosition().y; float x2 = x1 + thisFace.getWidth(); float y2 = y1 + thisFace.getHeight(); tempCanvas.drawRoundRect( new RectF(x1, y1, x2, y2), 2, 2, myRectPaint); } }

Page 40: Google Play Services Rocks!!!

Nearby API

Page 41: Google Play Services Rocks!!!

Nearby API

mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Nearby.MESSAGES_API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build();

// Publish bytes to send message = new Message(yourByteArray); Nearby.Messages.publish(mGoogleApiClient, message) .setResultCallback(new ErrorCheckingCallback("publish()"));

Page 42: Google Play Services Rocks!!!

Nearby API

// Create an instance of MessageListener messageListener = new MessageListener() { @Override public void onFound(final Message message) { // Do something with message.getContent() } };

// Subscribe to receive messages Nearby.Messages.subscribe(mGoogleApiClient, messageListener) .setResultCallback(new ErrorCheckingCallback("subscribe()"));

Page 43: Google Play Services Rocks!!!

Nearby API

Page 44: Google Play Services Rocks!!!

Android Wear

Node API

Message API

Data API

Channel API

Page 45: Google Play Services Rocks!!!

Fit

Page 46: Google Play Services Rocks!!!

Drive

Page 47: Google Play Services Rocks!!!

https://developers.google.com/android/

Page 48: Google Play Services Rocks!!!

Dúvidas?

Page 49: Google Play Services Rocks!!!

@nglauber

+NelsonGlauber

www.nglauber.com.br

Obrigado!