So Glass support is in a good place right now, here is what I came up with.
Google Glass Core - Adds Voice Trigger and Prompts results to application launching. Essentially makes your android app "Glass" friendly. https://github.com/aphex/cordova-glass-core Google Glass Touch - Adds Basic touchstart & touchend from the touchpad to the application. This is helpful as frameworks (like sencha touch) do there own gesture detection based on these events. https://github.com/aphex/cordova-glass-touch Google Glass Gesture - After looking over Joe's code I realized there are a lot of other applications out there that will want native gestures instead of JS interpreted ones. So this plugin adds all the gestures from the touchpad to the webview. This is the only plugin that required the Google Glass SDK, and this posed a problem. i could not find a good way to use the google glass SDK with my Cordova project. I will explain below. https://github.com/aphex/cordova-glass-gesture Barcode Scanner - I have forked and modified the barcode scanner plugin to properly work with Google Glass. Its hacky but using it is pretty awesome :) https://github.com/aphex/BarcodeScanner Again its worth noting that all the existing 'backbutton' even logic just works with google glass. A Swipe down will trigger that event if you have a listener. *Google Glass SDK Issue. * In order to use the Google Glass SDK properly there are a few options First during the build process the target of project.properties should be "Google Inc.:Glass Development Kit Sneak Peek:15". Currently if you attempt to change the target of a cordova project to that the CLI will break as it is not able to properly parse this. The issue is found in {app}/platforms/android/cordova/lib/check_reqs.js inside the get_target function. Error is on line 39 as of writing this. Target will be null and throw an error as the grep does not properly account for this. Even if we were able to fix this issue there does not seem to be a way for a plugin to change the target of project.properties anyway. So this would have to be manual, and annoying. Second is to link to the Google SDK jar file in the SDK folder, this can be found in {ANDROID_SDK}/add-ons/addon-google_gdk-google-15/libs. I was not able to find a way to get a plugin to link up a jar though. If anyone knows how to do this, please chime in. I tried doing jar.libs.dir in my local.properties file but that did not seem to work, I also worry if it did I would lose any jar files in my projects libs folder. So specifying another path to look for a jar file seems to be difficult, any ideas would be appreciated. Third (and my current solution) is to include the Google Glass jar with my plugin. So I have the gdk.jar file included with my plugin and then that file is copied into the android projects libs folder. This is not ideal as I really should be using the one provided by the SDK. I figure due to the fact that this is all alpha at this point anyway there is not a lot of fuss needed. I am assuming at some point we will be able to target glass normally using project.properties and a normal android target like android-20 or something. If anyone has a major beef with this I am all for alternatives, but for now this was the quick and easy way to handle this. Anyways I am working up some videos and demos on how to use all this. Figuring out a good way to film what is being seen on Glass is a tough one, but I have some ideas :) Also have a few Sencha Touch components in the works that are glass specific. We are likely doing an article for our January newsletter on all this jazz, should be good. Oh and if anyone cares to have them here are the Chrome emulation settings for Glass Screen Res: 640x360 DPR: 1 font Scale: 1 [x] Emulate Viewport [x] Enable Text Autosize [ ] Shrink to fit [ ] css media User Agent: Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Glass 1 Build/IMM76L; XE12) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Sensors [x] Emulate touch screen On Wed, Dec 25, 2013 at 2:49 PM, Ross Gerbasi <[email protected]> wrote: > Annddd... I'm an idiot. I do not know why I doubt cordova's awesomeness > before I jump into things. Adding a back button listener required no > updates to any of the code at all. It just simply works, add the listener > in JS and the glass app doesn't exit it dispatches a backbutton event. > Simple. > > > On Wed, Dec 25, 2013 at 2:29 PM, Ross Gerbasi <[email protected]> wrote: > >> Alrighty, more info, swipe_down default has been controlled the same way >> the back button is for normal android. If you have a backbutton listener it >> will bind the swipe down and dispatch a backbutton event instead of exiting >> the app. This should work for users to navigate around :) >> >> Now I need to find a way to apply what I have done via my touch plugin >> instead of modifications to the main activity... so moving along... >> >> >> On Wed, Dec 25, 2013 at 1:39 PM, Ross Gerbasi <[email protected]> wrote: >> >>> Swipe down actually appears to be more of a key up event. Going down >>> this road to try to cancel it. >>> >>> >>> On Wed, Dec 25, 2013 at 1:02 PM, Ross Gerbasi <[email protected]>wrote: >>> >>>> I haven't been able to find a way to prevent the SWIPE_DOWN event from >>>> closing the app, Joe you happen to dig into this? We really need swipe down >>>> dispatched on the webview. Any ideas? >>>> >>>> >>>> On Tue, Dec 24, 2013 at 3:36 PM, Ross Gerbasi <[email protected]>wrote: >>>> >>>>> Thanks Brian will do. >>>>> >>>>> For now I only know that of the XML for voice trigger. I will look >>>>> into coding it into a plugin. Great idea. >>>>> On Dec 24, 2013 4:04 PM, "Brian LeRoux" <[email protected]> wrote: >>>>> >>>>>> I could see something like this graduating to 'core' plugin status if >>>>>> it >>>>>> gets popular enough (and you are into it) Ross. For now, as Joe says, >>>>>> let >>>>>> it bake under your personal brand and feel free to enlist our help. :) >>>>>> On Dec 25, 2013 5:52 AM, "Ross Gerbasi" <[email protected]> wrote: >>>>>> >>>>>> > Copy that. >>>>>> > >>>>>> > Thanks >>>>>> > On Dec 24, 2013 11:22 AM, "Joe Bowser" <[email protected]> wrote: >>>>>> > >>>>>> > > They should go into your own package. I really shouldn't have used >>>>>> > > org.apache.cordova.glass. >>>>>> > > >>>>>> > > On Tue, Dec 24, 2013 at 9:20 AM, Ross Gerbasi <[email protected] >>>>>> > >>>>>> > wrote: >>>>>> > > > Also should I put these into my own package like >>>>>> > > > com.rossgerbasi.cordova.glass or should they go into >>>>>> > > > org.apache.cordova.glass ? >>>>>> > > > >>>>>> > > > thanks! >>>>>> > > > >>>>>> > > > >>>>>> > > > On Tue, Dec 24, 2013 at 11:13 AM, Ross Gerbasi < >>>>>> [email protected]> >>>>>> > > wrote: >>>>>> > > >> >>>>>> > > >> Well hot damn, maybe i won't need to then. thanks for the >>>>>> heads up. >>>>>> > > >> >>>>>> > > >> >>>>>> > > >> On Tue, Dec 24, 2013 at 11:02 AM, Joe Bowser < >>>>>> [email protected]> >>>>>> > wrote: >>>>>> > > >>> >>>>>> > > >>> On Tue, Dec 24, 2013 at 6:22 AM, Ross Gerbasi < >>>>>> [email protected]> >>>>>> > > wrote: >>>>>> > > >>> > >>>>>> > > >>> > Finally if I do go through with the plugin setup what do >>>>>> you all >>>>>> > > think >>>>>> > > >>> > about names for these plugins. Should it be something like >>>>>> > > >>> > cordova-glass-core which then opens the potential to have >>>>>> > > >>> > cordova-glass-voice, cordova-glass-camera, etc? >>>>>> > > >>> > >>>>>> > > >>> >>>>>> > > >>> The Camera and the Voice Recognition in Google Glass use the >>>>>> exact >>>>>> > > >>> same intents and code as Android. I don't see why you would >>>>>> want to >>>>>> > > >>> make them glass specific. >>>>>> > > >> >>>>>> > > >> >>>>>> > > > >>>>>> > > >>>>>> > >>>>>> >>>>> >>>> >>> >> >
