How to register a custom speech recognition service?

前端 未结 2 1768
广开言路
广开言路 2020-12-08 17:40

I created a simple speech recognition service: for this purpose I created a subclass of android.speech.RecognitionService and I created an activity to start and

2条回答
  •  难免孤独
    2020-12-08 18:21

    If you want queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0) to pick up your activity (VoiceServiceStarterActivity) then you have to declare in your app's Manifest that this activity handles RecognizerIntent.ACTION_RECOGNIZE_SPEECH, like this

    
      
        
        
      
      ...
    
    

    For more concrete code have a look at the project Kõnele (source code) which is essentially an open source implementation of the interfaces via which speech recognition is provided on Android, i.e. it covers:

    • ACTION_RECOGNIZE_SPEECH
    • ACTION_WEB_SEARCH
    • RecognitionService

    and uses open source speech recognition servers.

提交回复
热议问题