Home > Net >  Can we guarantee that Android's SpeechRecognizer does not send data to Google?
Can we guarantee that Android's SpeechRecognizer does not send data to Google?

Time:11-27

I'm trying to implement Android's SpeechRecognizer feature. Due to privacy constraints of my company, the data must explicitly not leave the device.

So far:

  • I've implemented the SpeechRecognizer class by using the SpeechRecognizer.createSpeechRecognizermethod. When I tried it without internet, it just worked fine! However, there's not guarantee as far as I see that Google won't send the data when online, if not for transcription, then for improving their Audio training data..
  • SpeechRecognizer.createOnDeviceSpeechRecognizer - This is available from Android 12 and on. Let's say I don't mind. However, it only works in specific devices, ie. Pixel 6 but not even in Pixel 4a.
  • putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true) - This didn't work either. It keeps giving me the error: ERROR_NO_MATCH, in any device that I've tried.

So that leaves us with plain SpeechRecognizer.createSpeechRecognizer and my implementation is like this:

var recognizerIntent: Intent? = null
        if (SpeechRecognizer.isRecognitionAvailable(applicationContext)) {
            sr = SpeechRecognizer.createSpeechRecognizer(applicationContext)

            val listener = MySpeechRecognitionListener(scopeProvider, lifecycleScope, {
                ...
            }
            sr.setRecognitionListener(listener)
            recognizerIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
                putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH)
            }
            sr.startListening(recognizerIntent)
} else {...}

Question: Can we somehow guarantee that Android's SpeechRecognizer does not send data to Google?

CodePudding user response:

you could ensure that internet connection (wifi, cell network, etc) is disabled during the recognizing however that does not guarantee that the recognized speech isn't recorded/cached and sent to google later when there is a network connection.

CodePudding user response:

Use:

public static SpeechRecognizer createSpeechRecognizer (Context context, 
                ComponentName serviceComponent)

specifying a serviceComponent that is open source, so that you can verify that it does not send data to Google.

I don't see any other solution, i.e. I'm not aware of any Android API flags like DONT_SEND_DATA_TO_GOOGLE.

  • Related