[MOD][XPOSED][4.1+] GoogleOfflineVoice - Force offline voice recognition/typing

Search This thread

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,797
Introduction
The voice recognition API does not allow apps to choose whether they want to use offline voice recognition or not. There's no setting for the user either. Instead, if there's an internet connection, it'll always use the online services.
This module allows you to force offline voice recognition/typing. This is useful if you're using a slow connection, if you're connected to a local network (without internet access,) etc.

What does this module do?
This module can force offline voice recognition for apps that use Google Voice. It'll work if the app uses one of the following:
  • Voice typing (used by keyboards, e.g. SwiftKey)
  • Voice recognition (for apps that use RecognizerIntent such as utter!)
It does so by setting a variable that indicates whether a network connection is available or not to false.
Voice commands inside the Google Search app aren't affected. Note that if offline voice recognition doesn't work for you in the first place, this module won't fix that.

Requirements:

Broadcasts:
You can toggle some settings from e.g. Tasker using broadcasts. Just use these action names:
  • com.germainz.googleofflinevoice.enable - Enables the module.
  • com.germainz.googleofflinevoice.disable - Disables the module.
  • com.germainz.googleofflinevoice.enable_voice_ime - Enables the module for voice typing.
  • com.germainz.googleofflinevoice.disable_voice_ime - Disables the module for voice typing.
Example from the shell:
Code:
am broadcast -a "com.germainz.googleofflinevoice.disable"

Source code:
https://github.com/GermainZ/GoogleOfflineVoice

Download:
http://repo.xposed.info/module/com.germainz.googleofflinevoice

Changelog:
Code:
[B]1.2.1:[/B] The widget now uses images to indicate the module's state. This should fix text getting cut off on some devices.
[B]1.2:[/B] Fix for the latest Google Search. Revamped blacklist. Added a simple widget to toggle module status (useful to quickly enable/disable GoogleOfflineVoice from e.g. your home screen).
[B]1.1:[/B]
The voice typing setting wasn't working correctly (because of a typo - offline voice typing was never forced.) Also, there was another typo in strings.xml, as a reboot is actually *not* required for the settings to apply.
[B]1.0:[/B] Initial release.

Thanks:
  • rovo89 for the Xposed Framework.
 
Last edited:

Dovidhalevi

Senior Member
Jun 26, 2012
2,729
1,171
I need just the opposite! Want to force / route to online recognition. Armv6.possibilities here?

Sent from my LG-P500 using xda app-developers app
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,797
I need just the opposite! Want to force / route to online recognition. Armv6.possibilities here?
I think the title and description are extremely clear.
Anyway, check this.

EDIT: actually, I don't understand what you want. Regardless, it doesn't seem related to what this mod does so no. :)
 
Last edited:

Andrev01

Senior Member
Nov 1, 2012
845
59
Gliwice
I don't know if I understand this clearly - this will able me to use Google Now voice recognition and Swiftkey voice typing when there's no data connection? But I'll still be able to use it when data is on?
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,797
I don't know if I understand this clearly - this will able me to use Google Now voice recognition and Swiftkey voice typing when there's no data connection? But I'll still be able to use it when data is on?
No. On Jelly Bean and higher, you can already use offline voice recognition/typing. That only happens when you're not connected at all, though. You can't force it if you're using a slow connection or if you're connected to a WiFi that's local (no internet access.) This module allows you to do that. I personally use it for SwiftKey and utter! because I find online recognition is too slow - at least with my internet connection.
 
  • Like
Reactions: gcappa and Zheen

Dovidhalevi

Senior Member
Jun 26, 2012
2,729
1,171
Tried it out anyway. Off-line recognition CAN work on Armv6--had it happen once, just once. Do not know how I got there but the armv7 code stands in the way. So maybe this module could bypass it.

I actually have two Google choices for recognition, one for Google Search (offline) and one for older Voice Search (online). Vlingo also exposes its engine as another working choice. I wish Nuance (they own it now) would expose there Dragon engine. Unfortunately, most apps no longer respect this choice. In fact, only Jeannie works now with the online recognition choice. The voice assistant does not work over KitKat Google Search and launcher.

So I enabled this module. Really did not change much. Jeannie still worked, seemed quicker but very subjective--I assume was still going online. Google Search did not FC but did not accept voice. Next browser's voice input pretended to work, as before. No results. Voice typing also pretended, no results. Dragon's (using Swype) works very well (online).

BTW, the linked kludge is for dictation, using an ICS modded Google Search to somehow retrieve a language file. Did not work for me but I have the file, manually symlinked to its presumably proper place. The poster does not use Google Search, only dictation.
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,797
So I enabled this module. Really did not change much. Jeannie still worked, seemed quicker but very subjective--I assume was still going online. Google Search did not FC but did not accept voice. Next browser's voice input pretended to work, as before. No results. Voice typing also pretended, no results. Dragon's (using Swype) works very well (online).

BTW, the linked kludge is for dictation, using an ICS modded Google Search to somehow retrieve a language file. Did not work for me but I have the file, manually symlinked to its presumably proper place. The poster does not use Google Search, only dictation.

This module can force offline voice recognition, by changing the following, and only for apps that use Google Voice:
  • Voice typing (used by keyboards, e.g. SwiftKey)
  • Voice recognition (for apps that use RecognizerIntent such as utter!)
You're unlikely to notice a big difference unless you're using a slow connection or are connected to a WiFi network without an internet connection.

Voice commands through Google Search aren't affected, so your "did not accept voice" isn't related to this module. As I've said, this only affects Google Voice - Dragon and other engines will still behave as before.

If offline voice recognition doesn't work for you in the first place, this module won't fix that.
 
Last edited:

AaronCompNetSys

Senior Member
Jun 19, 2007
305
86
Can someone coment if this would have significant savings on bandwidth, for people who are trying to keep it under a couple hundred meg cap? For a user who uses heavy dictation.
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,797
Update:
Code:
[B]1.1:[/B] The voice typing setting wasn't working correctly (because of a typo - offline voice typing was never forced.)
     Also, there was another typo in strings.xml, as a reboot is actually *not* required for the settings to apply.
Sorry :)

Can someone coment if this would have significant savings on bandwidth, for people who are trying to keep it under a couple hundred meg cap? For a user who uses heavy dictation.
It depends. Offline voice recognition isn't great for dictation unless you have a perfect accent and there's no background noise at all. You'll get unusable results otherwise.
Assuming it works perfectly, though, you'll save quite a lot, yes. Of course, it depends on how much you use it. But as I've said, offline dictation probably won't give you acceptable results, so you'll have to Try It And See™ and decide for yourself (also note that it wasn't working properly till this update.) :)
 
Last edited:
  • Like
Reactions: CatsAreGods

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,797
Hello, does it work with TouchPal XKeyboard? Because I can't use voice recognition. Using KitKat
Maybe, if it uses Google voice recognition. Try It And See™.

PS. I'm not sure what you mean be "I can't use voice recognition" - if it's failing even with an Internet connection them your problem is elsewhere.
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,797
Well @GermainZ, because I was using Google Keyboard too and nothing happens. To be sure, voice recognition works fine with an internet connection.

Enviado desde mi LG-E610 mediante Tapatalk

Voice typing != voice recognition. Google Keyboard should use voice typing, so make sure that setting is enabled. Read the OP for more info.
 
  • Like
Reactions: chrisdlc119

Top Liked Posts

  • There are no posts matching your filters.
  • 27
    Introduction
    The voice recognition API does not allow apps to choose whether they want to use offline voice recognition or not. There's no setting for the user either. Instead, if there's an internet connection, it'll always use the online services.
    This module allows you to force offline voice recognition/typing. This is useful if you're using a slow connection, if you're connected to a local network (without internet access,) etc.

    What does this module do?
    This module can force offline voice recognition for apps that use Google Voice. It'll work if the app uses one of the following:
    • Voice typing (used by keyboards, e.g. SwiftKey)
    • Voice recognition (for apps that use RecognizerIntent such as utter!)
    It does so by setting a variable that indicates whether a network connection is available or not to false.
    Voice commands inside the Google Search app aren't affected. Note that if offline voice recognition doesn't work for you in the first place, this module won't fix that.

    Requirements:

    Broadcasts:
    You can toggle some settings from e.g. Tasker using broadcasts. Just use these action names:
    • com.germainz.googleofflinevoice.enable - Enables the module.
    • com.germainz.googleofflinevoice.disable - Disables the module.
    • com.germainz.googleofflinevoice.enable_voice_ime - Enables the module for voice typing.
    • com.germainz.googleofflinevoice.disable_voice_ime - Disables the module for voice typing.
    Example from the shell:
    Code:
    am broadcast -a "com.germainz.googleofflinevoice.disable"

    Source code:
    https://github.com/GermainZ/GoogleOfflineVoice

    Download:
    http://repo.xposed.info/module/com.germainz.googleofflinevoice

    Changelog:
    Code:
    [B]1.2.1:[/B] The widget now uses images to indicate the module's state. This should fix text getting cut off on some devices.
    [B]1.2:[/B] Fix for the latest Google Search. Revamped blacklist. Added a simple widget to toggle module status (useful to quickly enable/disable GoogleOfflineVoice from e.g. your home screen).
    [B]1.1:[/B]
    The voice typing setting wasn't working correctly (because of a typo - offline voice typing was never forced.) Also, there was another typo in strings.xml, as a reboot is actually *not* required for the settings to apply.
    [B]1.0:[/B] Initial release.

    Thanks:
    • rovo89 for the Xposed Framework.
    4
    New version out, v1.2. Changes:
    • Fix for the latest Google Search;
    • Revamped blacklist;
    • Added a simple widget to toggle module status (useful to quickly enable/disable GoogleOfflineVoice from e.g. your home screen.)
    Note that the previous blacklist settings will be lost. I also recommend clearing the application's data to get rid of the old, now unused, blacklist.
    3
    The latest Google Search update breaks this module. Attached is a beta with the following changes:
    • Fix for the latest Google Search;
    • Revamped blacklist.
    Note that the previous blacklist settings will be lost. I also recommend clearing the application's data to get rid of the old, now unused, blacklist.

    It'd be great if there would be an option to disable this module on certain wifi-networks only.
    Also, a widget or notification to turn this module on/off would be great.
    I haven't looked into this yet, but FYI, you can do this using e.g. Tasker and intents (see OP.) Just thought I'd mention it if you want that functionality straight away.
    2
    I don't know if I understand this clearly - this will able me to use Google Now voice recognition and Swiftkey voice typing when there's no data connection? But I'll still be able to use it when data is on?
    No. On Jelly Bean and higher, you can already use offline voice recognition/typing. That only happens when you're not connected at all, though. You can't force it if you're using a slow connection or if you're connected to a WiFi that's local (no internet access.) This module allows you to do that. I personally use it for SwiftKey and utter! because I find online recognition is too slow - at least with my internet connection.
    2
    It'd be great if there would be an option to disable this module on certain wifi-networks only.
    Also, a widget or notification to turn this module on/off would be great.
    I need to check if the module still works with the latest Google Search update. I also want to revamp the blacklist as the current implementation is quite buggy. Once I get enough time to do that, I'll look into your suggestions. ?