Sorry for my poor english... xD
I'm writing some code to use Android's voice search. I have declared an intent like this:
SpeechRecognizer sr;
Intent intent_listener;
intent_listener = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent_listener.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent_listener.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,getPackageName());
intent_listener.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS,0);
sr.startListening(intent_listener);
Then i implemented RecognitionListener class and i put some code onResult method. this work but it's not accurate and sometimes it don'understand simple phrases. it also take a lot to have a result... so i tried with the visible box (that you can normally use to search something on your phone) and that's perfect.
aren't the same thing? why one of them is more accurated then other? am i wrong something with parameters? i'm working with android 4.0.3. thanks a lot to everyone!!
Don't set EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS to 0, rather do not set it at all.
To answer your question, the "visible box" and SpeechRecognizer are not necessarily "the same thing". They can be and probably often are, but there can also be cases where they are implemented by completely different speech recognition providers.
Related
How do I make my Text-To-Speech stop speaking? Right now, my TTS will start speaking when I launch my application, but I'm trying to make it stop speaking when a button on my Main Activity is pressed.
I have tried creating an onStop() method and using .stop, but to no avail.
May I please get some help on this issue?
You could do something along the lines of this ...
stopSpeakingButton.setOnClickListener(new
View.OnClickListener() {
String toSpeak = " ";
textToSpeech.speak(
toSpeaks,TextToSpeech.QUEUE_FLUSH,null);
});
As you gave us no code this a concept , not the most beautiful solution but will work if you adjust for your use case, the idea is to make it read string with onny a space in it!
I follow the following link's sample code
http://android.dronekit.io/first_app.html
and when I set API VehicleApi.getApi(this.drone).arm(true);
vehicleState.isFlying() automatically becomes true.
Can anybody tell me what this problem is?
What I need is:
1. take off, land
I read from some website that the dronekit-android does not support the mode changing. If so, how should I send the mavlink message to take off and land?
So far, I can sucessfully send the mavlink message to the PX4 board.
Thanks for replying.
Thank you for replying.
BR
SeanH
If you trace though some of the code in dronekit-android, you can see that isFlying is set here with the code below.
boolean isFlying = systemStatus == MAV_STATE.MAV_STATE_ACTIVE || ...;
MAV_STATE_ACTIVE, defined here states
System is active and might be already airborne. Motors are engaged.
So isFlying doesn't mean it's airborne but just that the motors are turned on. That occurs when you call VehicleApi.getApi(this.drone).arm(true); because you are literally arming the vehicle at that point.
For takeoff, you want to use the ControlApi. ControlApi.getApi(drone).takeOff(desired_altitude, listener) and for land you need to use VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_LAND, listener)
The sample code you're looking at is very old. I suggest you follow the sample app from github.
I have not tried android-dronekit before and I noticed that the src folder have not been updated for more than two years on github.
I advice you to use python-dronekit because there is a powerful library called pymavlink in python and used in python-dronekit. You can build hyper application if you want but first try to takeoff and land in python.
I was trying to make something in Adobe Flash, Air for android. I simply made a square and converted it to an Symbol (called 'hello') and I entered this code.
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
hello.addEventListener(TouchEvent.TOUCH_TAP, tap);
function tap(event:TouchEvent):void
{
hello.x+=15;
}
but nothing happend. I even used CODE SNIPPERS, and also tested this on my phone(ALCATEL onetouch idol mini), and it also said that there are no errors.What have I done wrong?
You set everything correctly but forget only one important thing: check if the system supports touchevent.
if(Multitouch.supportsTouchEvent)
I have created a soundboard and am having trouble getting just one sound to play at a time. If another button is pressed I want the current button to stop playing and the new button to begin. I also want sounds to stop when pressing the next or back button.
Is there any code that can help me out with this?
Here's some information for you that can help you solve your problem:
http://developer.android.com/reference/android/media/SoundPool.html
http://www.androidsnippets.com/playing-sound-fx-for-a-game
But like Falmarri pointed out, we're here to help on code and correct in need, not to write an app for you :)
The Android docs do not tell you how to build something, they only tell you what the parts do. Kinda like throwing parts at someone with detailed information of the parts, then expecting them to build an engine. The real world doesn't work that way!!
Here is what you need Paul. I use this code a lot:
private static SoundManager SM;//Field variable to hold sound manager.
SM = new SoundManager(); //Create sound manager
SM.initSounds(getBaseContext());
SM.addSound(1, R.raw.snd_loop_1);//Add sounds. Sounds go in /res/raw
SM.addSound(2, R.raw.snd_loop_2);
SM.addSound(3, R.raw.snd_ok_1);
Then you can call the sounds on demand with SM.playSound(1);
If you need a permanent running background loop, you can call the same sound with SM.playLoopedSound(2);
I hope it helps!
Background:
I recently purchased a Motorola XOOM Tablet along with the Desktop Dock and Bluetooth Keyboard accessories.
The dock and keyboard work great, but when I take the tablet off the dock to move away from my desk, the keyboard still remains paired with the device and I have to manually change the settings to use the soft keyboard. The same goes for when I set it back on the dock, I need to manually switch it back. It's not a huge problem, but it would be nice not to have to think about it.
So I tried downloading an app from the market that simply toggled Bluetooth on and off when connected or disconnected from a power source, which worked well for a while, but the background service would die after period and become useless until I manually restarted that.
TO THE POINT: I'm trying to write a little app/service for my tablet that will recognize when it has been docked/undocked and switch the "Use Physical Keyboard" setting accordingly.
I have started with a BroadcastReciever to recognize the Dock State:
public class DockBroadcastReciever extends BroadcastReceiver {
private final String DOCK_STATE_LABEL = "android.intent.extra.DOCK_STATE";
#Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
String message = (extras.getInt(DOCK_STATE_LABEL) == Intent.EXTRA_DOCK_STATE_UNDOCKED) ? "Undocked" : "Docked";
Toast toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
toast.show();
}
}
But I'm having trouble figuring out the best way to update the setting after the event is fired. I've poked around some examples using InputMethodManager, but all the methods seem to need a specific EditText or some other input to bind to.
Furthermore, I can't seem to find a corresponding constant that represents that setting anywhere in the docs, but graphically, it is located here: http://i.stack.imgur.com/esFaw.png
Can anyone help me out with this?
I would like for there to be a solution for changing the setting, but I am open to other ideas as well.
I have an app that does something similar. It can toggle wifi and bluetooth based on power.
You'll need to register some of this stuff in the AndroidManifest.xml file.
http://code.google.com/p/futonic-wifioncall/source/browse/AndroidManifest.xml
Project Open Source Site: http://code.google.com/p/futonic-wifioncall/
This isn't the solution but hopefully will give guidance on what you're trying to accomplish.