Autore Topic: Search Widget che non lancia activity: help!  (Letto 666 volte)

Offline ligio

  • Nuovo arrivato
  • *
  • Post: 24
  • Respect: +1
    • Mostra profilo
    • Ligio Blog
  • Dispositivo Android:
    htc wildfire, ZT180 v2
  • Play Store ID:
    Marco Lijoi
  • Sistema operativo:
    Windows Vista
Search Widget che non lancia activity: help!
« il: 23 Ottobre 2011, 11:26:00 CEST »
0
Ciao!
Ho seguito la guida di Google per implementare un' interfaccia di ricerca.
A questo punto ho aggiunto nel file searchable.xml la dicitura android:includeInGlobalSearch="true" e anche android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" (per abilitare il bottone di ricerca vocale)

In questo modo, aggiungendo il widget standard di ricerca di Google, posso selezionare la mia applicazione fra le modalità di ricerca (dopo averla abilitata nella configurazione)

Se inserisco una frase di ricerca scrivendola nel campo di input, la ricerca funziona correttamente!
Se invece premo sul bottone di input vocale, appare il dialog per il riconoscimento vocale, dopo che ho parlato visualizzo correttamente l'onda vocale, ma poi si chiude tutto e la mia activity di ricerca non viene istanziata (ho provato a inserire dei log.d in diverse parti del codice ma non vengono richiamati)!

Se provo la ricerca vocale selezionando come modalità di ricerca quella WEB, tutto funziona correttamente, anche la ricerca vocale!

Qualcuno ha già affrontato lo stesso problema? Come avete risolto?

ciao e grazie!


Posto qui il logCat della ricerca vocale:

Codice: [Seleziona]
10-23 11:23:33.216: VERBOSE/InputDevice(2467): ID[0]=0(0) Dn(0=>1)
10-23 11:23:33.220: VERBOSE/WindowManager(2467): Dsptch > Window{484aac98 com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher paused=false}
10-23 11:23:33.326: VERBOSE/WindowManager(2467): Dsptch > Window{484aac98 com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher paused=false}
10-23 11:23:33.326: VERBOSE/InputDevice(2467): ID[0]=0(0) Up(1=>0)
10-23 11:23:33.333: ERROR/AudioTrack(2467): getAudioMode[0]
10-23 11:23:33.333: INFO/ActivityManager(2467): Starting activity: Intent { act=android.speech.action.RECOGNIZE_SPEECH flg=0x10000000 cmp=com.google.android.voicesearch/.IntentApiActivity bnds=[389,111][464,194] (has extras) }
10-23 11:23:33.353: INFO/Launcher(2587): onPause()
10-23 11:23:33.372: WARN/Launcher(2587): WallpaperManager setVisibility visible true
10-23 11:23:33.384: DEBUG/AudioHardwareALSA(2369):  ALSA OPEN mode 0,device 2
10-23 11:23:33.384: INFO/AudioHardwareALSA(2369): Try to open ALSA PLAYBACK device AndroidPlayback_Speaker_normal
10-23 11:23:33.411: INFO/AudioHardwareALSA(2369): Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
10-23 11:23:33.411: DEBUG/AudioHardwareALSA(2369): Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
10-23 11:23:33.411: DEBUG/AudioHardwareALSA(2369): Using 2 channels for PLAYBACK.
10-23 11:23:33.411: DEBUG/AudioHardwareALSA(2369): Set PLAYBACK sample rate to 44100 HZ
10-23 11:23:33.411: DEBUG/AudioHardwareALSA(2369): Buffer size: 2048
10-23 11:23:33.411: DEBUG/AudioHardwareALSA(2369): Latency: 46439
10-23 11:23:33.501: DEBUG/WifiService(2467): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@481102d0}
10-23 11:23:33.513: INFO/RecognitionControllerImpl(3141): startRecognition(#Intent;action=android.speech.action.RECOGNIZE_SPEECH;launchFlags=0x10800000;component=com.google.android.voicesearch/.IntentApiActivity;sourceBounds=389%20111%20464%20194;B.fullRecognitionResultsRequest=true;S.calling_package=com.google.android.googlequicksearchbox;S.android.speech.extra.LANGUAGE_MODEL=free_form;i.android.speech.extra.MAX_RESULTS=1;end)
10-23 11:23:33.513: INFO/RecognitionControllerImpl(3141): State change: STARTING -> STARTING
10-23 11:23:33.513: VERBOSE/AudioRecord(3141): set(): sampleRate 16000, channels 16, frameCount 16000
10-23 11:23:33.517: DEBUG/AudioHardwareInterface(2369): AudioHardwareBase::setParameters(downgain=1)
10-23 11:23:33.517: INFO/AudioHardwareALSA(2369): [virtual int android::AudioHardwareALSA::setCodecStatus(int)], Data=5
10-23 11:23:33.517: ERROR/AudioHardwareALSA(2369): AudioStreamInALSA - input   - format = 1, channels = 16, rate = 16000
10-23 11:23:33.517: VERBOSE/AudioHardwareALSA(2369): # virtual uint32_t android::AudioStreamInALSA::getAndroidChannels(int)
10-23 11:23:33.517: ERROR/AudioHardwareALSA(2369): AudioStreamInALSA - default - format = 1, channels = 16, rate = 44100
10-23 11:23:33.517: VERBOSE/AudioHardwareALSA(2369): # virtual uint32_t android::AudioStreamInALSA::getAndroidChannels(int)
10-23 11:23:33.517: VERBOSE/AudioHardwareALSA(2369): # virtual uint32_t android::AudioStreamInALSA::getAndroidChannels(int)
10-23 11:23:33.517: INFO/AudioHardwareALSA(2369): AudioStreamInALSA lrate - mDefaults->sampleRate = 44100
10-23 11:23:33.517: DEBUG/AudioHardwareALSA(2369):  ALSA OPEN mode 0,device 262144
10-23 11:23:33.517: INFO/AudioHardwareALSA(2369): Try to open ALSA CAPTURE device AndroidRecord_Speaker_normal
10-23 11:23:33.517: INFO/AudioHardwareALSA(2369): Initialized ALSA CAPTURE device AndroidRecord_Speaker_normal
10-23 11:23:33.517: DEBUG/AudioHardwareALSA(2369): Set CAPTURE PCM format to S16_LE (Signed 16 bit Little Endian)
10-23 11:23:33.517: DEBUG/AudioHardwareALSA(2369): Using 1 channel for CAPTURE.
10-23 11:23:33.517: DEBUG/AudioHardwareALSA(2369): Set CAPTURE sample rate to 44100 HZ
10-23 11:23:33.521: DEBUG/AudioHardwareALSA(2369): Buffer size: 5733
10-23 11:23:33.521: DEBUG/AudioHardwareALSA(2369): Latency: 130000
10-23 11:23:33.611: ERROR/AudioFlinger(2369): readInputParameters mInputBytes 4160, mFrameSize 2 mSampleRate 44100 mChannelCount(1)
10-23 11:23:33.611: ERROR/(2369): AFCCreateReSampler: avAFCInfo->bUsed[0] inSampleRate[44100] outSampleRate[16000] nChannel[1] outbitDepth[16]
10-23 11:23:33.611: DEBUG/AudioHardwareALSA(2369): Entering AudioStreamInALSA::standby
10-23 11:23:33.611: VERBOSE/AudioRecord(3141): AudioRecord::set() minFrameCount = 2080
10-23 11:23:33.611: DEBUG/AudioHardwareALSA(2369): Entering AudioStreamInALSA::standby
10-23 11:23:33.634: DEBUG/dalvikvm(2467): GC_FOR_MALLOC freed 30225 objects / 1425624 bytes in 84ms
10-23 11:23:33.665: INFO/AudioService(2467):  AudioFocus  requestAudioFocus() from android.media.AudioManager@4813ae78
10-23 11:23:33.665: INFO/RecognitionControllerImpl(3141): State change: STARTING -> RECOGNIZING
10-23 11:23:33.665: INFO/ServerConnectorImpl(3141): Starting TCP session, url=http://www.google.com/m/voice-search
10-23 11:23:33.673: VERBOSE/AudioRecord(3141): start
10-23 11:23:33.673: DEBUG/AudioHardwareALSA(2369): AudioStreamInALSA::setParameters() routing=262144;vr_mode=1
10-23 11:23:33.677: DEBUG/AudioHardwareALSA(2369):  ALSA OPEN mode 0,device 262144
10-23 11:23:33.677: INFO/AudioHardwareALSA(2369): Try to open ALSA CAPTURE device AndroidRecord_Speaker_normal
10-23 11:23:33.677: INFO/AudioHardwareALSA(2369): Initialized ALSA CAPTURE device AndroidRecord_Speaker_normal
10-23 11:23:33.677: DEBUG/AudioHardwareALSA(2369): Set CAPTURE PCM format to S16_LE (Signed 16 bit Little Endian)
10-23 11:23:33.677: DEBUG/AudioHardwareALSA(2369): Using 1 channel for CAPTURE.
10-23 11:23:33.677: DEBUG/AudioHardwareALSA(2369): Set CAPTURE sample rate to 44100 HZ
10-23 11:23:33.681: DEBUG/AudioHardwareALSA(2369): Buffer size: 5733
10-23 11:23:33.681: DEBUG/AudioHardwareALSA(2369): Latency: 130000
10-23 11:23:33.763: DEBUG/AudioHardwareALSA(2369): set wake lock from read@..2239.
10-23 11:23:33.779: INFO/ActivityManager(2467): Displayed activity com.google.android.voicesearch/.IntentApiActivity: 402 ms (total 402 ms)
10-23 11:23:33.783: DEBUG/dalvikvm(3141): GC_FOR_MALLOC freed 1532 objects / 163384 bytes in 42ms
10-23 11:23:33.857: INFO/Launcher(2587): onWindowFocusChanged(false)
10-23 11:23:33.986: DEBUG/ServerConnectorImpl(3141): Created session f737f6ac33365c0d80a0d4499827776f
10-23 11:23:33.986: INFO/ServerConnectorImpl(3141): Creating TCP connection to 74.125.39.126:19294
10-23 11:23:34.025: INFO/RecognitionControllerImpl(3141): onReadyForSpeech, noise level:23.06015, snr:-1.0359155
10-23 11:23:34.029: INFO/RecognitionActivity(3141): Start-up latency 638 ms
10-23 11:23:34.138: INFO/ServerConnectorImpl(3141): startRecognize RecognitionParameters{session=f737f6ac33365c0d80a0d4499827776f,request=1}
10-23 11:23:34.626: INFO/WifiMonitor(2467): Event [ SCAN-RESULTS ]
10-23 11:23:35.478: DEBUG/dalvikvm(3141): GC_FOR_MALLOC freed 1316 objects / 86128 bytes in 75ms
10-23 11:23:35.591: INFO/RecognitionControllerImpl(3141): onBeginningOfSpeech
10-23 11:23:36.327: WARN/PowerManagerService(2467): Timer 0x3->0x3|0x0
10-23 11:23:36.595: INFO/AudioHardwareALSA(2369): Output standby called!!. Turn off PCM device.
10-23 11:23:37.177: INFO/RecognitionControllerImpl(3141): onEndOfSpeech
10-23 11:23:37.181: INFO/AudioService(2467):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@4813ae78
10-23 11:23:37.197: VERBOSE/AudioRecord(3141): stop
10-23 11:23:37.271: DEBUG/AudioHardwareALSA(2369): Entering AudioStreamInALSA::standby
10-23 11:23:37.275: DEBUG/AudioHardwareALSA(2369): AudioStreamInALSA::setParameters() routing=0
10-23 11:23:37.275: VERBOSE/AudioRecord(3141): stop
10-23 11:23:37.275: VERBOSE/AudioRecord(3141): stop
10-23 11:23:37.275: VERBOSE/AudioRecord(3141): stop
10-23 11:23:37.279: DEBUG/AudioHardwareInterface(2369): AudioHardwareBase::setParameters(downgain=0)
10-23 11:23:37.279: INFO/AudioHardwareALSA(2369): [virtual int android::AudioHardwareALSA::setCodecStatus(int)], Data=4
10-23 11:23:37.283: DEBUG/dalvikvm(3141): GC_EXTERNAL_ALLOC freed 670 objects / 99248 bytes in 78ms
10-23 11:23:37.658: INFO/ServerConnectorImpl(3141): Response: Gaia Result missing
10-23 11:23:37.665: INFO/RecognitionControllerImpl(3141): State change: RECOGNIZING -> RECOGNIZED
10-23 11:23:37.677: INFO/RecognitionControllerImpl(3141): Final state: RECOGNIZED
10-23 11:23:37.724: INFO/ServerConnectorImpl(3141): ClientReport{session_id=f737f6ac33365c0d80a0d4499827776f,request_id=1,application_id=intent-speech-api,client_perceived_request_status=0,request_ack_latency_ms=141,total_latency_ms=3546,user_perceived_latency_ms=505,network_type=1,endpoint_trigger_type=3,}
10-23 11:23:37.748: INFO/AudioService(2467):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@4813ae78
10-23 11:23:37.810: INFO/ClientReportSender(3141): Sending 1 client reports over HTTP
10-23 11:23:37.810: INFO/RecognitionControllerImpl(3141): State change: RECOGNIZED -> CANCELED
10-23 11:23:37.818: INFO/RecognitionControllerImpl(3141): State change: CANCELED -> CANCELED
10-23 11:23:37.822: INFO/AudioService(2467):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@4813ae78
10-23 11:23:37.837: INFO/Launcher(2587): onResume(). mIsNewIntent : false
10-23 11:23:37.837: ERROR/(2587): onResume() check 0
10-23 11:23:37.837: ERROR/(2587): onResume() check 1
10-23 11:23:37.837: ERROR/(2587): onResume() check 2, mRestoring : false
10-23 11:23:37.841: ERROR/(2587): onResume() check 3
10-23 11:23:37.841: ERROR/(2587): onResume() check 4
10-23 11:23:37.841: ERROR/(2587): onResume() check 5
10-23 11:23:37.845: ERROR/Launcher(2587): MTP-LAUNCHER: media scanning not yet finished .
10-23 11:23:37.845: INFO/Launcher(2587): onResume() ended
10-23 11:23:37.857: INFO/Launcher(2587): onWindowFocusChanged(true)
10-23 11:23:37.904: INFO/RecognitionControllerImpl(3141): State change: CANCELED -> CANCELED
10-23 11:23:37.947: INFO/SpeechServiceHttpClient(3141): Closing the HTTP client.
10-23 11:23:38.556: DEBUG/WifiService(2467): releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@481102d0}
10-23 11:23:38.847: WARN/Launcher(2587): WallpaperManager setVisibility visible true