Google Glass quick start demo on HANA
Nowadays, wearable devices are one of the hot topics of technology. Google just released its Android Wear SDK and Google Glass is becoming more common in daily life. Until November 2013, only the developers that have Google glass device could develop applications for glass. But after November 2013 Google opened Mirror API for all developers.
You have two options to develop for glass:
- Mirror API:The Google Mirror API allows you to build web-based services, called Glassware, that interact with Google Glass. It provides this functionality over a cloud-based API and does not require running code on Glass.
- With Mirror API, you can;
- Managing timeline cards
- Interacting with menu items
- Subscribing to timeline notifications
- Sharing to contacts
- Working with user location
- With Mirror API, you can;
- Glass Development Kit: The Glass Development Kit (GDK) is an add-on to the Android SDK that lets you build Glassware that runs directly on Glass.
Ps: Our demo application was developed by Mirror API, so rest of the blog is about Mirror API.
Run Google Glass application on SAP Hana Cloud platform
- Install Hana Studio and Tools
- Download attached .war file and import it into Hana Studio
Ps: I strongly recommend to you follow openSAP courses of Thomas Jung and Rui Nogueira about Hana Topic
In this blog scope we will use Java Quick Start Demo of Google. Google also serves demo projects in other platforms, i chose Java platform because Hana cloud platform can run java applications. I modified original demo to run on Hana Cloud Platform. In original demo project, Google uses Apache Maven to manage package dependencies. To prevent you fighting with packages, i export my modified demo in war file, so i suggest you to use attached war file.
At the end of the operations we will deploy demo to Hana Cloud Platform. Then users will authorize via created url on cloud platform. After successful login, current timestamp, name and location of user are saved to Hana Database and a timelinecard is posted with the last logged in users data.
Deploy Quick Start Demo:
There is two major task to deploy demo
- Creating a Google APIs Console project:
Google has a detail tutorial to create a console project. You can follow the instructions.
The created client ID and client secret for my project:
- Importing project to hana studio
Download attached .war file and import project into Hana studio. (If you want to try Quick start demo independently from Hana studio, please download .zip file, import it as archieve project into eclipse)
If everything is OK Then;
- Open “oauth.properties” file under “com.google.glassware” package and copy your client_id & client_secret values that were created in Google Api Console project.
- Set Context Root to “/” from project->properties->”Web Project settings” (after login, google redirect you to project root, i don’t want to change original project so leave like this)
- If needed, change java version from project->properties->”Project Facets” (application is running smoothly with java 1.6 or 1.7)
- if you using eclipse instead of Hana Studio install m2e in eclipse and be sure Maven library is setted from project->properties->”Deployment Assembly”
The modifications & new developments over original demo project;
- For new developed classes, com.hana package was created
- UserInfo class was created, to get&keep user login info
- HanaMirrorClient class was created, to post timelinecard on glass
- UserDAO class was created, to manage Hana database operations (jdbc was used)
- “Append Hana Log” button was added into index.jsp file
- to get user info, UserInfo instance was created in index.jsp file
- To post a new timelinecard as soon as user login, NewUserBootstrapper class was modified
After all the last operation is deploying project. To deploy on Sap Hana Cloud, in hana studio go to servers section, add a new Hana Cloud Portal Server and run your project on hana server.(For this step, You can find detail instructions on Rui Nogueira openSap videos).
Ps:If you run project in eclipse, Download Tomcat(version is very important I tried with Tomcat7.0.52), add it as a new server in eclipse and run your project on Tomcat Server.
Test Your Project:
Open Hana Cloud cockpit and go to your deployed application details. There is a url to run your application. You can run my application via https://hanaonglass1p104935trial.hanatrial.ondemand.com to post yourself a timelinecard.
If you wonder how timelinecard will look on google glass device, you can use google playground application via https://developers.google.com/glass/tools-downloads/playground . In order to use the Playground with the Google Mirror API, you need to insert your project’s client ID. To test my application paste “236007231554.apps.googleusercontent.com” to textbox and click authorize.
I’m living in Turkey and Google Glass hasn’t sold here yet. So i should say that i couldn’t try application on device. If someone who has glass maybe try application on device, and we will be very glad with feedbacks.
Thanks a lot to Randy Middleton. He run demo on glass and send screenshots to us. Now we are sure that demo is working on device smoothly(Google Glass Explored XE16.11 – XE16.2). Nice collaboration in SCN Community !! 😎
Thanks a lot to Markus Van Kempen. He deployed the code to his own trial cloud account. Now we are sure that attached code can be deployed without defect and it is working on device with version XE 20.1 flawlessly.
Thank for sharing of things to come....
Thanks for your comments!!
Hi @Basar Ozgur Kahraman ,
You always come with something new ..... very nice ..... keep it up 🙂
Thank you Ashish,
i like playing with new technologies 🙂
Loved reading the blog !
Glad to hear that ! 🙂
Do you still need someone with Glass to try this for you? I have Glass and just ran across this article. It looks very interesting and I would be willing to give it a try and send you a Glass vignette screenshot of the timeline card.
I'll be much appreciated, if you can try this demo on device. I am very curios about how timelinecard looks on glass screen. if you send me screenshots, i will attached them to this blog. Thank you for your attention!
You brought sap to another level.
Sap Hana introduces us new capabilities, the only thing we should use them for different domains with various technologies.
I have Google Glass also. Google Glass Explored XE16.11. Updated 28-April-2014. No issues on Glass so far.
I am going through your demo. Thanks again for you blog and this demo.
it is very nice to hear that 🙂 At last someone could try demo on device. Can you take screenshots? i want to publish screenshots of device on blog. i will be greateful if you send me.
Here is a screen capture that shows the Start of the application on Glass. Your Cat.
Vignette that has the Start-up of Java Demo.
Amazing innovation, to tap into hana from Google glass...
Thank you very much for your motivating comment..
Awesome blog Basar, It's a next level jump. Thank you so much for sharing and encouraging to go further with this new innovative ideas where one feet in Google Glass and another in HANA Cloud both of peaks of new technologies.
Thank you for the kind words..
Amazing blog!! Thank you so much for sharing such a nice innovation.
I liked this blog. It is amazing to see this types of innovative jobs. Thanks for sharing.. I am looking forward to new ones ; )
Great blog. I was researching something about Google Glass and HANA.
Infact I am building a prototype to show Google Charts on Google Glass, fetching data from Hana database.
Interested for more collaboration. if interested let me know.
Thank You Ritesh,
You can reach me via direct message.
Awesome work .... just deployed the code and it works flawlessly with XE 20.1.
Happy to hear that 🙂
Now we are sure that it is also working on version XE 20.1. I am updating the blog..
Thank you very much Markus!!
yes realy happy to hear this!!!