Using Google Datastore for your Android app

837 views

Published on

This presentation was used for a talk I delivered at the March Meetup of Bangalore Android Users Group - http://drawty.me/12e9v. During this talk, I showed step-wise how we used Google Datastore and Google App engine for DrawTyme, and how you can easily do so too!

For more details, follow the blog post - http://drawty.me/ua44g

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
837
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Using Google Datastore for your Android app

  1. 1. Using Google Datastore for Android apps Gaurang Kanvinde (gaurang.kanvinde@drawtyme.com) An example of how Google Datastore was used for DrawTyme (http://drawty.me/ua44g) +
  2. 2. 22-Mar-2014 2©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Overview of Google Datastore • Non-relational database • Cloud based • Ready to use • Requires Google App Engine and Google Endpoints – Very inexpensive and simple to use – Can be programmed in many languages – Java, Python, etc – Extensive documentation available
  3. 3. 22-Mar-2014 3©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved The Development Environment • Eclipse for Java EE - Download and install • Google Plugin for Eclipse – Instructions to install
  4. 4. 22-Mar-2014 4©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Setting up Google App Engine • Create a project on Google App Engine - Link to Console • Remember it’s Project-ID
  5. 5. 22-Mar-2014 5©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved The nuts and bolts • Two main directories – src • Contains all the code of the app – war • Contains a sub-directory named WEB-INF – Contains the compiled binaries of the code in “src” – Contains other dependencies – Everything else that goes into the app • Contents of this directory will be deployed to the Google App Engine – index.html (if any, will go here) • Code available at: DrawTymeExample.zip
  6. 6. 22-Mar-2014 6©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Understanding the code • The Video class
  7. 7. 22-Mar-2014 7©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Writing the API • Defining the API class with @Api annotation
  8. 8. 22-Mar-2014 8©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Writing the API • Adding authenticated methods
  9. 9. 22-Mar-2014 9©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Writing the API • Adding unauthenticated methods
  10. 10. 22-Mar-2014 10©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Preparing to Deploy • Write app-ID of your project in war/WEB-INF/appengine- web.xml
  11. 11. 22-Mar-2014 11©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Setting up Datastore Indexes • war/WEB-INF/datastore-indexes.xml – If you get the contents of this file wrong, Google App Engine suggests the correct content for you!
  12. 12. 22-Mar-2014 12©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved A quick peek at the Web-app • war/js/backend.js – Initialising the API
  13. 13. 22-Mar-2014 13©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved A quick peek at the Web-app • war/js/backend.js – Calling API functions
  14. 14. 22-Mar-2014 14©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Deploying to App Engine • Use Google Plugin button – Deploy to App Engine – Sign-in to the App Engine is required
  15. 15. 22-Mar-2014 15©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved It works!
  16. 16. 22-Mar-2014 16©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Porting to Android • AppEngine SDK has all the tools! – Use endpoints.cmd or endpoints.sh • Eg: $PATH_TO_SDK/bin/endpoints.cmd get-client-lib com.example.api.classname – Android code will be generated and stored in myapi-v1-java.zip
  17. 17. 22-Mar-2014 17©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved Locating the Android code for Endpoints
  18. 18. 22-Mar-2014 18©2014 DrawTyme Technologies Pvt. Ltd., All rights reserved And we are done! • Have fun using Google App Engine! • Contact me Gaurang.kanvinde@drawtyme.com Twitter: @gaurangrk • DrawTyme http://www.drawtyme.com Twitter: @drawtyme Facebook: https://www.facebook.com/drawtyme Blog: http://blog.drawtyme.com

×