Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // set some extras context.startActivity(intent); 2013/12/24 Ross Gerbasi <rgerb...@gmail.com> > You are correct, the idea of changing an attribute was a bad one. I am not > doing that anymore, I am following what you were doing now with a separate > activity. Can you paste in a code snippet from your "CordovaGlassActivity" > where you use getLaunchIntentForPackage to launch the users main activity? > > thanks! > > > On Tue, Dec 24, 2013 at 9:29 AM, Axel Nennker <ignisvul...@gmail.com>wrote: > >> Why do you need the attribute to be changed? >> If you use a separate activity you can set all the attributes you want on >> it; like the nohistory=true in my example >> I start the "main" cordova activity through getLaunchIntentForPackage >> As a class inheriting from CordovaPlugin you get all the OS messages: >> GoogleGlassPlugin::onNewIntent >> >> Could you upload your plugin code to e.g. >> https://github.com/rgerbasi/cordova-googleglass-plugin >> >> -Axel >> >> >> >> >> >> >> 2013/12/24 Ross Gerbasi <rgerb...@gmail.com> >> >>> Alright nevermind on the variable thing. this is starting to shape up. >>> you >>> can run it like this >>> >>> cordova plugin add ~/Desktop/Google\ Glass\ >>> Cordova/dev/cordova-glass-core/ >>> --variable VOICE_COMMAND='wazzup cordova' >>> >>> Still need a way to modify an attribute or get the android:name... >>> >>> >>> On Tue, Dec 24, 2013 at 8:38 AM, Ross Gerbasi <rgerb...@gmail.com> >>> wrote: >>> >>> > Ok progress on all this, creating the resource files was actually >>> really >>> > easy, also modifying the manifest is working great. The only thing >>> left is >>> > trying to either modify an attribute of a config file or having access >>> to >>> > the value of android:name= on the existing activity. Anyone have any >>> ideas >>> > on how I could do either of those things? >>> > >>> > Lastly is there anyway to pass in a variable that plugin XML can use? I >>> > would like the user to be able to do something like cordova plugin add >>> > [URL] [VOICE_COMMAND] where voice command is the string they wish to >>> say >>> > to open the application. Any ideas? thanks! >>> > >>> > Also chime in on the name of this plugin if you have any opinion :) >>> > >>> > >>> > >>> > On Tue, Dec 24, 2013 at 8:22 AM, Ross Gerbasi <rgerb...@gmail.com> >>> wrote: >>> > >>> >> I really do like the idea of using the plugin XML, I think Axel has a >>> >> good start but as mentioned is there a way to handle xml resources >>> via a >>> >> plugin? I need to copy a couple files (or write some xml) into the >>> >> resources folder then I also need to make an addition to strings.xml >>> in the >>> >> values resources. >>> >> >>> >> Lastly it would be nice to be able to add the intent to an existing >>> >> activity instead of having to create an activity just for glass. The >>> >> template for android already has the activity I wish to run I just >>> need to >>> >> change the intent for it. Otherwise is there anyway to get the name >>> of the >>> >> current activity for use in my own? >>> >> >>> >> I guess it would be nice if the plugin could have more then just >>> >> plugin.xml, possible a node script that also ran that would allow me >>> to >>> >> actually do modifications myself? >>> >> >>> >> 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? >>> >> >>> >> Dan - I already have a working hook, but it all feels dirty. It is an >>> >> after_platform_add hook that then modifies your android project. It >>> just >>> >> doesn't feel clean doing it this way, a plugin would be much nicer. >>> >> >>> >> -ross >>> >> >>> >> >>> >> On Tue, Dec 24, 2013 at 7:05 AM, Dan Moore <moore...@yahoo.com> >>> wrote: >>> >> >>> >>> Hi Ross. >>> >>> >>> >>> Wow, this will be really cool! >>> >>> >>> >>> You can manipulate the Android manifest and listen for intents with a >>> >>> plugin. See this example plugin.xml that does so: >>> >>> >>> https://github.com/8zrealestate/android-referrer-plugin/blob/master/plugin.xml >>> >>> >>> >>> Some of the limits of plugins right now (unless things have radically >>> >>> changed since I looked at them in Cordova 3.0): >>> >>> * you cannot remove nodes from an xml file >>> >>> * you cannot change values or attributes of xml file nodes >>> >>> * you can't modify any other kind of file. >>> >>> >>> >>> If you need to do any of the above kind of file manipulation, you >>> should >>> >>> use a hook. But I don't know a way to include a hook into a plugin. >>> >>> >>> >>> -- >>> >>> Dan Moore >>> >>> https://leanpub.com/developingwithcordovacli/ >>> >>> >>> >>> >>> >> >>> > >>> >> >> >