I am trying to use the googlequicksearchbox to do some actions directly, without the click button confirmation...
for example:
When I click at the mic of Google Now and say "Me acorde às 9:00" (Wake-up me at 9)... Google now makes an alarm for 9 without needing confirmation. Like this:
But if I use this intent:
String query = "Me acorde às 9:00";
final Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.setPackage("com.google.android.googlequicksearchbox");
intent.putExtra(SearchManager.QUERY, query);
startActivity(intent);
to start googlequicksearchbox with the same text that was recognized, Google Now makes the alarm, but now requires confirmation click at the blue button (reminders, etc, also requires). Like that Screenshot >> Screenshot alarm require confirmation
Someone knows some way of make the intent start google search with a query and not requires the click confirmation? like "simulate a google now voice command"??
P.S1.: I am using my own voice recognition inside of my app for other purposes, and I am trying to make the Google Now interpret the voice for just some commands... So, unfortunately, I can't execute the google now voice recog...
P.S2.: I don't know how to interpret the voice (get the hour, minutes, etc.) and make the alarm by the direct intent... then, use the google now to interpret is the best option for me.
Related
I would like to make a Intent to send the user to the settings screen which it has the switch to enable the Live Captioning introduced by Android 10, is there any way to to this intent?
The manual way is as described in this post
I've tried this intent:
startActivity(Intent(ACTION_CAPTIONING_SETTINGS));
But it redirects to general captions activation
The only intent i found was working is
startActivity(Intent("com.android.settings.action.live_caption"))
(category DEFAULT if you want to pass that as well)
I found this by finding the top activity when I had it open on my phone with adb and then inspecting the settings application to find intents matching the activity name.
Be aware, this is not an offical way to open this dialog. It may be subject to change and is very likely to differ between devices.
I could not find an Intent which is more general, so I'm assuming there's no offical way to open the activity.
I am trying to develop an application for Android wear that on a button click will ask the user to speak something and send it to a webserver. I also need to have a list of pre-defined templates, similar to what Hangouts works.
What I have tried:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Send to server");
startActivityForResult(intent, SPEECH_REQUEST_CODE);
This works, but I cannot supply the user a set of pre-defined templates.
Reading this - https://developer.android.com/training/wearables/notifications/voice-input.html I see that it is possible to do this in a notification... but this will not be in the front, I need this UI to be modal/blocking, so a notification is not good for my use case.
What are my options? How can I implement this?
Unfortunately, other than Receiving Voice Input in a Notification there is no way to use voice recognition with pre-defined text responses.
Based on the documentation : Adding Voice Capabilities
Voice actions are an important part of the wearable experience. They let users carry out actions hands-free and quickly. Wear provides two types of voice actions:
System-provided
These voice actions are task-based and are built into the Wear platform. You filter for them in the activity that you want to start when the voice action is spoken. Examples include "Take a note" or "Set an alarm".
App-provided
These voice actions are app-based, and you declare them just like a launcher icon. Users say "Start " to use these voice actions and an activity that you specify starts.
Also as discussed in 24543484 and 22630600, both implemented a notification in their android to get the voice input.
Hope this helps.
Is there a way to automatically start Google Now on Music Recognition? I'd need it to create a DashClock extension that start Music Recognizing...
As far as I speak, I can start package com.google.android.googlequicksearchbox successfully but I cannot start voice input... I would not use startActivity for result since I would not need a result, I would really just start Google Now voice recognition feature, is there a way to do it programmatically?
Otherwise, to simply launch Google Now Song Recognition service (without having to tap on "Listen to Music", to be clear), you can create an Intent with the string
"com.google.android.googlequicksearchbox.MUSIC_SEARCH";
that would launch directly the proper interface.
I just found a way to achieve my goal:
Intent intent = new Intent();
intent.setClassName("com.google.android.googlequicksearchbox","com.google.android.googlequicksearchbox.VoiceSearchActivity");
starting this intent will bring up voice search window.
I'd like to write an app that monitors incoming SMS and notify me on the watch if the content of SMS contains a predefined text (e.g. "go home").
I know I can use the notification API to add an event. It will vibrate and show a small app icon on the watch. What if I want to use control API to flash LED and show the whole text and an image on the watch when it receives the SMS, how should I do?
It's very similar to the "Call handling" add-on. Can Sony open the source of "Call handling" for reference?
I think you have two options. Either, as you say, 1) implement an extension that uses both the notification API and the control API. Or 2) just implement a control extension.
For 1), you could add a custom action that starts your control extension using the START_REQUEST intent below. See the doAction1 method in the SampleNotificationExtension code. This would mean that a standard notification will be shown on the watch, then you will be able to present a custom view to the user, if the user clicks the custom action button.
And for 2), implement your functionality completely as a control extension and request for it to be started when you get the SMSs that is found by your filter. Drawback is that you need to present the SMS text yourself, which in case 1) is done by the framework for you.
START_REQUEST-intent example:
Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "your.package.name");
intent.setPackage(hostAppPackageName);
sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);
So I've searched far and wide for some sort of solution to the issue regarding removing Google's Voice Recognition UI dialog when a user wants to perform a Voice Command but have been unable to find any solution. I am trying to implement an app which displays a menu to the user and the user can either click on the options or say the options out loud which will open the new pages. So far ive been unable to implement this unless I use Googles RecognizerIntent but I dont want the dialog box to pop up. Anyone have any ideas? Or has anyone solved this issue or found a workaround? Thanks
EDIT: As a compromise maybe there is a way to move the dialog to the bottom of the screen while still being able to view my menu?
Does How can I use speech recognition without the annoying dialog in android phones help?
I'm pretty sure the Nuance/Dragon charges for production or commercial applications that use their services. If this is just a demo, you may be fine with the developer account. Android speech services are free for all Android applications.
You know that you can do this with google's APIs.
You've probably been looking at the documentation for the speech recognition intent. Look instead at the RecognitionListener interface to the speech recognition APIs.
Here's some code to help you
public class SpeechRecognizerExample extends Activity implements RecognitionListener{
//This would go down in your onCreate
SpeechRecognizer recognizer = SpeechRecognizer.createSpeechRecognizer(this);
recognizer.setRecognitionListener(this);
//Then you'd need to start it when the user clicks or selects a text field or something
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
//intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "zh");
intent.putExtra("calling_package",
"yourcallingpackage");
recognizer.startListening(intent);
//Then you'd need to implement the RecognitionListener functions - basically works just like a click listener
Here's the docs for a RecognitionListener:
http://developer.android.com/reference/android/speech/RecognitionListener.html