Google Glass : How to back to menu items after select an item with voice triggers? - google-glass

I've wrote an app which triggers with voice and the sequence is,
Say "ok glass"
Say "Testing App" (to launch my app)
Say "ok glass" again. (to load the menu items, I have 5 menu items with sub menu each.)
Say "Dining Hall" (list all the sub menu items)
Say "Off" (one of the sub menu)
Will pop up a card says the command is executed.
My app will then have to go through step 3 again to show the list of the menu items.
May i know is there anyway to straight list all the menu items and ready to receive another voice triggers after step 6?

When the card pops up make sure you set your menu parameters the same as they where when started. Not sure what you are exactly doing since you're not providing any code.
but you can use this line of code to make sure your voice commands "reset"
getWindow().invalidatePanelMenu(WindowUtils.FEATURE_VOICE_COMMANDS);
invalidateOptionsMenu();
Hope that is what you're looking for

Related

How to close window in apex builder on clicking a button

I have an apex page where I have a button "SAVE & CLOSE" . On click of that button, I first want to save the data and then close the page.
I have a PLSQL code at point "Processing" to save the data.
I have then created a Branch at Point = "After Processing" and Type ="PLSQL Procedure" and written below code to close the window.
Begin
htp.p('<script type="text/javascript" >');
htp.p('window.close();');
htp.p('</script>');
end;
I have added the button's name in server side condition : When button Pressed.
But this doesn't work. When I click on apply, it doesn't close the window. It gives me an error :
"Error: SyntaxError: Unexpected token < in JSON at position 0 "
Can you please help me resolve this error and tell how can I close the window in button click.
Thanks,
Abha
You can use only APEX components and not write a single line of code :)
Set action for your button to "Submit page" - so all items will be submitted to use their values in processing. Image below will help you.
Now, for processing your pl/sql code use process in processing(left side on the picture).
Here you can create a new process and set type to "Close dialog" this process will automatically close the window. Without any javascript etc.. Apex is processing from top to bottom, so if you make this process last, it will always close the window after all processes are done.
You can as well set process server side condition, so it will not trigger every time.
Be careful with javascript - some web browsers are processing them in different way.
Hope it will help. Have a nice day !
Hi I got it working with other method :
Instead of type : PLSQL Procedure" select Type = "Page or URL Redirect"
and give
javascript:window.close()
in the Target.
This works.
What I did was make the page Modal. Then I added a Button called btnClosePage with a Dynamic Action (True Event) that calls "Close Dialog". I am working in Oracle Apex 20.2.

Not able to select option from dropdown box in an android mobile application

I have to automate payment gateway process for my native android application for which i have to select option from dropdowon box. After selecting an option "continue" button will be enabled.
On clicking continue button it takes me to new screen where payment details will be entered.
I'm facing following issues:
1) Not able to select drop down menu option after scrolling in the drop drown.
2) Able to select the option from first 5 options which are visible when dropdwon opens without any scrolling.after the option selection continue button has to be enabled by defalut.i am able to see that option got selected but not able to click on continue button.Script is not returning any error but i am sure it is not clicking on continue button.
Before clicking on dropdown id and class of dropdown are packagename;id/statechooser and android.widget.spinner respectively.
After click on dropdown id and class are android:id/text1 and android.widget.Textview.
Below is my code.
#entering Name
self.driver.find_element_by_id('packagename:id/name').send_keys('App Test');
self.driver.keyevent(66)
#entering address line 1
self.driver.find_element_by_id('packagename:id/address_line_1').send_keys('Madison Boulevard')
self.driver.keyevent(66)
self.driver.find_element_by_id('packagename;id/city').send_keys('Madison');
self.driver.find_element_by_id('packagename;id/zip').send_keys('25758');
self.driver.keyevent(66)(#this event for moving to dropdown)
self.driver.keyevent(66)(#this event for opening dropdown)
self.driver.find_element_by_xpath("//android.widget.TextView[#text='Alabama']").click()
self.driver.find_element_by_id('packagename:id/continue_button').click();
Finally I got solution for this. By using python wrapper for UIAUTOMATOR I am able to proceed to next page.I am using down method until the option is visible and then pressing enter to accept it instead of click method. Below is the code.
while(self.d(resourceId="android:id/text1").text!='Hawaii'):
self.d.press('down');
self.d.press('enter')

How do you customise Glass contextual voice menu in an immersion *after* its initial setup?

I've successfully populated the contextual voice menu of my glassware immersion but I want to be able to change the menu after the initial set up in onPreparePanel() or onCreatePanelMenu() as described here: Programmatically populated contextual "ok glass" menu.
Ideally one of the callbacks would be called after receiving the 'ok, glass' voice command but as far as I can tell, none of them are. Outcome, you're stuck with the version of the voice commands menu as it was the first time you cam into the activity.
So far, the only hack that's come close was when I pulled the GlassVoice.apk off the device and set up a manual VoiceListener (as discussed here: Glass voice command nearest match from given list). When the voice command is detected an onVoiceCommand is called, I try to force a refresh of the menu by calling invalidateOptionsMenu() (no effect) or getWindow().invalidatePanelMenu(WindowUtils.FEATURE_VOICE_COMMANDS). This second one looks like it tries to pull up the menu but then instantly hides it again.
How can I dynamically change the contextual voice menu later on in the lifetime of the activity?
I actually just wrote a sample app and this is working fine for me.
Be sure to use onCreatePanelMenu() to create the voice menu and check
if (featureId == WindowUtils.FEATURE_VOICE_COMMANDS ||
featureId == Window.FEATURE_OPTIONS_PANEL) ...
to inflate the menu for both touch menu and voice menu.
To refresh both, in onMenuItemSelected(), make sure to call both invalidateOptionsMenu() to refresh the touch menu and getWindow().invalidatePanelMenu(WindowUtils.FEATURE_VOICE_COMMANDS) to refresh the voice menu. I just flipped a boolean on the first menu item selection, which I used to determine whether an old or new menu should be inflated.
What version of Glass are you running on?

how to hide ok glass label from google glass voice menu

Hi I am developing a application fro Google glass ,I want to hide the "OK glass" command which is essential to launch the menu on voice command so is there a way in which i can launch a menu options on voice command without saying the " OK glass " keyword every time.
kindly guide me on this.
You cannot do this at the moment using Contextual voice commands. In my opinion, it was for the best, otherwise the Glass user could occasionally select a menu item unintentionally.
Maybe you can implement an alternative using SpeechRecognizer, maybe you'll find this thread a bit helpful.
Here is an example on how to use a decompiled version of the GlassVoice.apk found on Glass:
https://github.com/pscholl/glass_snippets/tree/master/voiceMenu
which allows to display a menu (or not), display "ok glass" (or not) and add hotwords dynamically (or not). Offline without using the SpeechRecognizer API.

Cocoa-track the menu of/inject options into itunes

Is there a way I can inject menu items into itunes or detect when menu items are pressed. I have an itunes plugin that executes code when iTunes launches, but how can I use that to detect menu item clicks or possibly inject new menu item options? For example adding a new contextual menu item when you right click on a library item, or detecting when the users clicks "Like" from the Ping menu.
Whatever functionality is not provided by an app's scripting bridge would only be accessible by hackery.
iTunes a Carbon app, not Cocoa, so that's more for you to learn about. iTunes even uses a call to ptrace(), passing PT_DENY_ATTACH to prevent you attaching a debugger to snoop around at runtime as well.
In other words, this is by no means an easy thing to do.