I suggest to use a plugin. A plugin can add to the AndroidManifest.xml and add any Java package needed (your code to handle OS events (intents)).
I do not understand what "...until we can work with intents via a plugin" means? Your plugin can add an Activity definition with an IntentFilter to the AndroidManifest.xml. That Activity can then send an Javascript event to Cordovas Javascript. 2013/12/24 Ross Gerbasi <rgerb...@gmail.com> > So do you suggest trying to do this as a plugin? Or is that pretty much a > no go until we can work with intents via a plugin? > > I am not also sure what you mean by the main launcher intent. I am using > IntelliJ IDEA and the debugger waits until i launch the app on Glass > automatically via voice or the menu. So I just run in debug mode and then > launch my app, it then hooks itself up. > > > > > On Mon, Dec 23, 2013 at 10:06 PM, Joe Bowser <bows...@gmail.com> wrote: > > > On Mon, Dec 23, 2013 at 7:56 PM, Andrew Grieve <agri...@chromium.org> > > wrote: > > > Neat stuff! > > > > > > If possible, it would definitely be neat to make glass work more > > > out-of-the-box with Cordova. I'm totally unfamiliar with what tweaks > are > > > necessary to make it work though. > > > > > > One thing that's possible already is to use a custom template. This is > > the > > > 4th parameter to the create command - a path to a directory to use as > the > > > project template. > > > > > > Would be awesome if all of the tweaks could be done via a cordova > plugin. > > > Plugins have the <config-file> tag, which allows you to edit XML > > (although > > > limited) on plugin install time. > > > > > > > I've done some work with this on this PoC here: > > https://github.com/infil00p/CordovaGlass/ > > > > The thing that we have to consider is that plugins don't have to just > > be confined to a single class. There's nothing that says > > that plugins can't move resource files, add node scripts or add Java > > classes other than ones descended from CordovaPlugin.java. The only > > tricky bit that I see is that we're needing to modify the > > AndroidManifest.xml to handle the VOICE_TRIGGER intent, which is > > required so that when you say "Ok Glass", it does something. > > > > The other thing is that you want to keep the main launcher intent for > > debugger purposes, because otherwise you'll have to manually add code > > to listen for the debugger after you say "OK Glass". > > > > As far as whether it should be its own platform in the CLI, that whole > > argument is for CLI people to discuss. > > > > Joe > > > > > > > > > > > On Mon, Dec 23, 2013 at 10:43 PM, Ross Gerbasi <rgerb...@gmail.com> > > wrote: > > > > > >> Hello All, > > >> > > >> I have been working on Google Glass support for Cordova and hit a > wall. > > I > > >> am looking for some guidance/advice on how to proceed. There are a > > couple > > >> things that I need to deal with but I will start with just creating > the > > >> proper project. I have a feeling this will not only be about google > > glass > > >> but a issue we will come across later. > > >> > > >> Essentially in order to make this happen I need to modify > > >> AndroidManifest.xml and add some resources to the project. Ideally > This > > >> would be a custom template of some kind for an android project. > Possibly > > >> running a command like "cordova platform add android glass". The other > > >> option is to just modify the existing android project after it has > been > > >> added, this seems messy though and a problem if the user trashes the > > >> android project they have to remember to run whatever command modifies > > the > > >> project for glass again. > > >> > > >> Once I am able to get a basic project together for Glass the next > thing > > is > > >> events. In order to get touch pad events into the webview it requires > a > > bit > > >> of tweaking, so I need some java code to handle this. I am not sure if > > this > > >> should be a plugin or not. It seems like it should not be a plugin as > it > > >> really is essential for the project to even really work. I could then > > see > > >> voice as a plugin? > > >> > > >> Currently I am planning on making a 3rd party node package that you > > would > > >> run against your project. Something like "cordova-glass > > __VOICE_TRIGGER__", > > >> that would then check for an android project, create it if needed, > then > > >> modify it for glass. It would add the voice trigger to start your app > > and > > >> such. If it already exists it will just make the tweaks needed. This > > will > > >> at least get the ball rolling and allow people to start building apps > > >> pretty easily, then maybe we can find a more efficient way to create > the > > >> project for users? > > >> > > >> Anyways I would love for anyone to chime in, I will be cranking away > on > > >> this but any ideas would be greatly appreciated. > > >> > > >> -ross > > >> > > >