14

Question

How to force Google Voice Recognition working in offline mode even if an internet connection is available?

Background

I know Google Voice Recognition has an offline mode1, using "speech recognition packs" one can download.2 I'm also aware that this offline-mode is limited, compared to what it can do via Internet. Still, being a little paranoid on Google's data collection I rather avoid using its online facilities – and so I currently don't use Google Voice Search at all.

I'd like to give it a try, though – but always switching to airplane mode for that is not practical. My devices are all rooted, and have the XPosed Framework installed. I know about the GoogleOfflineVoice module – but that hasn't been updated since 9/2014 and is reported to be non-operational with the current Google Search app (plus it's unclear if the dev will pick up the work; I've just asked about that, answer was "Honestly no idea" (dev lacking time)).

Other benefits

It's reported that Google Voice Search is much faster in offline mode. So if one doesn't need the "extended capabilities" of its online mode, faster reaction will certainly be welcome – which makes this question interesting not only for "privacy fetishists", "conspiracy theorists" and "paranoid users" :)

Question (refined):

So I'm looking for alternatives: simple settings preferred, commands definitely accepted, root-solutions are fine. If it requires an app, that app itself should require none or only minimal permissions itself. I'm also open to speech-recognition suggestions not involving Google Voice Search as long as they work offline and don't invade privacy3.

Note:

I'm mainly interested in giving voice commands and maybe doing some dictation.

Related information


1: see: How to use speech-to-text offline?
2: see Google Voice Search requiring internet access even when offline speech recognition pack is installed
3: Internet permission just to download voice-packs is OK, as I can block it as soon as the download is completed. Manual download (placing the files on the SD card) preferred :)

8
  • 3
    What I've found thus far indicates that any third-party apps ought to set the android.speech.extra.PREFER_OFFLINE extra to get this behavior. I'm looking into how a user might control it. Blocking the IP range does not seem to be feasible since it overlaps with other Google services like the Play Store. Commented May 26, 2016 at 5:37
  • Hmm, something is broken. Voice Search was originally working for me offline (limited as you mention) but now it refuses to work at all, just saying "Can't reach Google at the moment." Commented May 26, 2016 at 6:59
  • @MatthewRead Maybe that's the reason GoogleOfflineVoice stopped working: Exactly the same error was reported on that. So it's not the module broken, but Voice Search. Yuck. // BTW: Thanks for the edit!
    – Izzy
    Commented May 26, 2016 at 8:48
  • 2
    Raw idea of a work-around: 1) block the INTERNET permission of the Voice app (whichever that is). Probably won't work as it will utilize Google Play Services I'm afraid. 2) Using a firewall app to block the specific servers. That would require to know which servers that are. If that triggers something for one of you, a solution on that path would be nice to know as well :)
    – Izzy
    Commented Oct 19, 2016 at 14:34
  • Looks like there is no solution for this (2 years later)
    – distante
    Commented Feb 21, 2018 at 19:34

2 Answers 2

2

I have been able to block the shady online service and force offline mode (for termux-speech-to-text) by identifying the user which (only) runs the offending googlequicksearchbox processes (from a root shell):

# /system/bin/ps -Awo uname,cmdline | grep -m1 -E " com\.google\.android\.googlequicksearchbox:search$" | cut -d" " -f1
u0_a41

(note: I specified Android's built-in ps path to avoid conflicts with other user-installed versions of ps which don't take the same parameters - ie. on Termux)

...and adding a firewall rule to block all outgoing traffic for this user's processes:

# iptables -A OUTPUT -m owner --uid-owner u0_a41 -j DROP

(this rule will go away after rebooting or running the same command with -D instead of -A)

3
  • Nice idea! One could use AFWall+ (or an init.d script) to persist that rule. Could you please include why exactly that user/app is the one to be blocked? Is there e.g. some documentation saying this app is providing the voice-recognition functionality?
    – Izzy
    Commented Jul 23, 2021 at 7:23
  • 1
    I didn't find this in any documentation, but by analyzing the overall traffic with tcpdump -n while running termux-speech-to-text (which uses the same service) I saw lots of UDP packets going to a Google IP (which would change when blocked) at port 443 (If I blocked all UDP traffic going to a :443 it would fall back to TCP). Then, from netstat -tunp I found that the process opening the matching connection was always "com.google.android.googlequicksearchbox:search" (which in my case always belongs to the "u0_a41" user).
    – Arnau C.
    Commented Jul 24, 2021 at 13:29
  • Thanks a lot! Though I no longer use GApps (my devices run Google-free for years already) and thus cannot test/verify it, it sounds fit – so I'll accept your answer \o_
    – Izzy
    Commented Jul 25, 2021 at 11:18
0

I have examined this issue and found the following to be true:

Google's Android OS seems to be configured to send all voice recognition tasks to the "cloud", as there are no provisions in the OS to allow for hardware voice processing, even if your device supposidly supports this nonexistent feature.

In other words, Google has taylored their Android OS to send all voice commands to their "cloud". This provides them with the ability to constantly update a user's voice profile with every command by processing audio data on their servers, giving them access to a great wealth of data for analytical and commercial uses.

Remember, personal data as well as "group" data is an assett to Google and its affilliates. The "big data" industry, which includes the sale and processing of all types of personal data (digital photos, live video, video files, voice recordings, web search/visit history, online purchases, etc...) is projected to be a 500 billion dollar industry by 2025.

Google needs Android to capture audio and video data (and all other usable personal digital information) and send it to their servers for analysis. Their business model is heavily dependent on the analysis and sales of your personal data, without restriction.

1
  • 2
    Well, it's known that it works that way. Hence my question was not "why is it thus", but "how to avoid this". So thanks for your explanation, Justin – but it does not answer my question. Still useful information for some. // Btw: no longer for me, I've meanwhile totally ditched Google stuff on my phones – which now run without the GApps package, so I'd have to rephrase my question to "how to achieve offline vouce recognition (without Google, only using FOSS)".
    – Izzy
    Commented Jul 14, 2021 at 6:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .