GoogleIntegration inAndroid AppsRonan Schwarz and Friedger MüffkeMoosecon - 8 March 2013
Android and Google● Android Open  Source Project (AOSP)  all, cheap, free● Open Handset Alliance  84 companies, Google gov...
Google for developers so far● Some Content Provider API,  e.g. calendar contract● Intents to launch apps  e.g. Navigation●...
Google Play Framework (gms)● Requires Android 2.2 and Google Play● APK that provides APIs to Google services● Service APK ...
Google Play Framework (gms)         Requires real device
Helper methods● Always check for availability first!● Use isGooglePlayServicesAvailable() in  onResume● Give the user a ch...
Authentication  http://www.flickr.com/photos/carlosluzz/
Authentication● OAuth2 through GoogleAuthToken class● get the Google Account(s) by  ○   AccountManager  ○ AccountPicker.ne...
Authentication Error Handling● User Recoverable Error  ○ UserRecoverableAuthException  ○ GooglePlayServicesAvailabilityExc...
Google Plus
Google Plus● Updated on 26 February 2013● Policy  ○ not to misuse personal data and +1 links  ○ only use Google provided b...
Google Plus: SetupServicesOAuth2 client
Google Plus: SetupIdentifyeach client
PlusClient: initializePlusClient.Builder()...build()PlusClient.connected() and .disconnected()within component lifecycleAl...
PlusClient: Sign-In● Visual user consent <com.google.android.gms.   common.SignInButton    android:id="@+id/sign_in_button...
PlusClient: Social Graph● Profile of the user  mPlusClient.loadPerson(this, "me"); // or "108591961893121462921"● People i...
PlusClient: App Activities● Moments: "possibility to   AddActivity  share what user has done   BuyActivity  in the app"   ...
PlusShare: Share Content● Simple share intent   PlusShare.Builder.getIntent()● Deep linking   setContentDeepLinkId()   set...
PlusShare: Deep Linking● Intent filter in Manifest<activity android:name=".ParseDeepLinkActivity">  <intent-filter>     <a...
PlusOneButton: Recommendations● Add a +1 Button to anything <com.google.android.gms.plus.PlusOneButton   xmlns:plus=    "h...
Over-the-air install (7 March)● Setup web client● Sign-in Button + app package name● Quality control by  Google (?)
Google Maps: V2
Google Maps: V2● Fragments!● Fragments for older Devices!● Views!● Activities ?● Breaks compatibility.
Google Maps: Camera● 2-Axis Rotation● Perspective View● Zoom● Move● Target
Google Maps: Markers● Default Markers● Customize  Appearance● Show InfoWindow● InfoWindow != View● Add/Remove  Markers man...
Google Maps: Custom Drawing● Lines● Circles● Polygons● Points are Lat,Long pointsPolygon polygon = map.addPolygon(    new ...
Goodies    http://www.flickr.com/photos/g-alain/
ImageManager● Load Images from an external resource in  the background● Can specify a default resource for errors etc● As ...
PanoramaClient● Load from URL● Load from ContentProvider● Zoom and Rotate
Hints● Debugadb shell setprop log.tag.GooglePlusPlatform VERBOSE● Lots of example codes and documentation athttps://develo...
Questions            Ronan Schwarz            Friedger Müffke            novoda.com            @novoda            #moosecon
Upcoming SlideShare
Loading in …5
×

Mooscon 2013 cebit - google integration in android apps (1)

1,536 views
1,513 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,536
On SlideShare
0
From Embeds
0
Number of Embeds
488
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Mooscon 2013 cebit - google integration in android apps (1)

  1. 1. GoogleIntegration inAndroid AppsRonan Schwarz and Friedger MüffkeMoosecon - 8 March 2013
  2. 2. Android and Google● Android Open Source Project (AOSP) all, cheap, free● Open Handset Alliance 84 companies, Google governance● Android Update Alliance promise to update● Google User Experience CTS and relevance
  3. 3. Google for developers so far● Some Content Provider API, e.g. calendar contract● Intents to launch apps e.g. Navigation● Java libs and Web APIs e.g gdata client lib to connect to Google Docs
  4. 4. Google Play Framework (gms)● Requires Android 2.2 and Google Play● APK that provides APIs to Google services● Service APK will and must be installed automatically
  5. 5. Google Play Framework (gms) Requires real device
  6. 6. Helper methods● Always check for availability first!● Use isGooglePlayServicesAvailable() in onResume● Give the user a chance to install the missing file with getErrorDialog()● getOpenSourceSoftwareLicenseInfo()
  7. 7. Authentication http://www.flickr.com/photos/carlosluzz/
  8. 8. Authentication● OAuth2 through GoogleAuthToken class● get the Google Account(s) by ○ AccountManager ○ AccountPicker.newIntent()● Email needed for retrieving auth token● getToken() for UI components● getTokenWithNotification() for Services
  9. 9. Authentication Error Handling● User Recoverable Error ○ UserRecoverableAuthException ○ GooglePlayServicesAvailabilityException ○ UserRecoverableNotifiedException● Non-Recoverable Error ○ GoogleAuthException
  10. 10. Google Plus
  11. 11. Google Plus● Updated on 26 February 2013● Policy ○ not to misuse personal data and +1 links ○ only use Google provided branding ○ provide means to revoke authorization
  12. 12. Google Plus: SetupServicesOAuth2 client
  13. 13. Google Plus: SetupIdentifyeach client
  14. 14. PlusClient: initializePlusClient.Builder()...build()PlusClient.connected() and .disconnected()within component lifecycleAll calls are asyncronous .onConnected() and .onDisconnected()
  15. 15. PlusClient: Sign-In● Visual user consent <com.google.android.gms. common.SignInButton android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_height="wrap_content" />● startResolutionForResult() on click● optional sign-out button● required revoke method with deletion of data
  16. 16. PlusClient: Social Graph● Profile of the user mPlusClient.loadPerson(this, "me"); // or "108591961893121462921"● People in the circles of the user mPlusClient.loadPeople(this, Person.Collection.VISIBLE);● Email address (PlusClient.getAccountName()) requires additional permission GET_ACCOUNTS
  17. 17. PlusClient: App Activities● Moments: "possibility to AddActivity share what user has done BuyActivity in the app" CheckInActivity CommentActivity CreateActivity● Prepare snippet DiscoverActivity (or let prepare) ListenActivity ReserveActivity● writeMoment(moment) ReviewActivity WantActivity● removeMoement(moment)● listMoments()
  18. 18. PlusShare: Share Content● Simple share intent PlusShare.Builder.getIntent()● Deep linking setContentDeepLinkId() setContentUrl()● Interactive posts addCallToAction()● Can be ActionBar or (standard) Button● Breaks ShareActionProvider
  19. 19. PlusShare: Deep Linking● Intent filter in Manifest<activity android:name=".ParseDeepLinkActivity"> <intent-filter> <action android:name="com.google.android.apps.plus.VIEW_DEEP_LINK" /> <data android:scheme="vnd.google.deeplink" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter></activity>● Extract deep link id PlusShare.getDeepLinkId(this.getIntent());
  20. 20. PlusOneButton: Recommendations● Add a +1 Button to anything <com.google.android.gms.plus.PlusOneButton xmlns:plus= "http://schemas.android.com/apk/lib/com.google.android.gms.plus" plus:size="standard"/>● One URL per button mPlusOneButton.initialize(mPlusClient, URL);● No Meta-Data
  21. 21. Over-the-air install (7 March)● Setup web client● Sign-in Button + app package name● Quality control by Google (?)
  22. 22. Google Maps: V2
  23. 23. Google Maps: V2● Fragments!● Fragments for older Devices!● Views!● Activities ?● Breaks compatibility.
  24. 24. Google Maps: Camera● 2-Axis Rotation● Perspective View● Zoom● Move● Target
  25. 25. Google Maps: Markers● Default Markers● Customize Appearance● Show InfoWindow● InfoWindow != View● Add/Remove Markers manually
  26. 26. Google Maps: Custom Drawing● Lines● Circles● Polygons● Points are Lat,Long pointsPolygon polygon = map.addPolygon( new PolygonOptions() .add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3,5)) .strokeColor(Color.RED) .fillColor(Color.BLUE));
  27. 27. Goodies http://www.flickr.com/photos/g-alain/
  28. 28. ImageManager● Load Images from an external resource in the background● Can specify a default resource for errors etc● As easy as loadImage(ImageView,Uri,defaultResId)● Only G+ URLs● For everything else use the novoda ImageLoader on github.com/novoda
  29. 29. PanoramaClient● Load from URL● Load from ContentProvider● Zoom and Rotate
  30. 30. Hints● Debugadb shell setprop log.tag.GooglePlusPlatform VERBOSE● Lots of example codes and documentation athttps://developer.android.com/google/play-services/index.html● G+ Bootcamp for companieshttp://googleplusplatform.blogspot.de/2013/03/global-google-sign-in-bootcamps.html Berlin, Germany - March 18th - March 22ndMore to come...
  31. 31. Questions Ronan Schwarz Friedger Müffke novoda.com @novoda #moosecon

×