Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,300 Members 52,599 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
GermainZ
Old
(Last edited by GermainZ; 21st May 2014 at 02:09 PM.)
#1  
GermainZ's Avatar
Forum Moderator / Recognized Developer - OP
Thanks Meter 5604
Posts: 4,951
Join Date: Aug 2012
Default [MOD][XPOSED][4.1+] GoogleOfflineVoice - Force offline voice recognition/typing

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.g...leofflinevoice

Changelog:
Code:
1.1: 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.
1.0: Initial release.
Thanks:
  • rovo89 for the Xposed Framework.
The Following 24 Users Say Thank You to GermainZ For This Useful Post: [ Click to Expand ]
 
Dovidhalevi
Old
#2  
Senior Member
Thanks Meter 955
Posts: 1,972
Join Date: Jun 2012
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
Old
(Last edited by GermainZ; 3rd February 2014 at 10:23 AM.)
#3  
GermainZ's Avatar
Forum Moderator / Recognized Developer - OP
Thanks Meter 5604
Posts: 4,951
Join Date: Aug 2012
Quote:
Originally Posted by Dovidhalevi View Post
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.
 
Andrev01
Old
#4  
Andrev01's Avatar
Senior Member
Thanks Meter 53
Posts: 764
Join Date: Nov 2012
Location: 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?
Phone: SE Xperia Ray - Urushi | ROM: 4.4.4 Carbon nightly (20140711) | Kernel: 3.4.95-nAa+ | Baseband: 86 | smartassv2 - sio / 122 MHz - 1017 MHz
Tablet: Samsung Galaxy Tab 2 7.0 P3100 | ROM: 4.4.4 Carbon nightly (20140721) | Kernel: NEXT 2.2.2 | PhillZ Touch 6.48.4 | interactive - cfq / 300 MHz - 1008 MHz
 
GermainZ
Old
#5  
GermainZ's Avatar
Forum Moderator / Recognized Developer - OP
Thanks Meter 5604
Posts: 4,951
Join Date: Aug 2012
Quote:
Originally Posted by Andrev01 View Post
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.
The Following User Says Thank You to GermainZ For This Useful Post: [ Click to Expand ]
 
StraightEdgeKid
Old
#6  
StraightEdgeKid's Avatar
Senior Member
Thanks Meter 55
Posts: 256
Join Date: Feb 2012
Location: Pune
Good app, was looking for something like this since long.

sent from public phone using coins.
 
Dovidhalevi
Old
#7  
Senior Member
Thanks Meter 955
Posts: 1,972
Join Date: Jun 2012
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
Old
(Last edited by GermainZ; 3rd February 2014 at 04:57 PM.)
#8  
GermainZ's Avatar
Forum Moderator / Recognized Developer - OP
Thanks Meter 5604
Posts: 4,951
Join Date: Aug 2012
Quote:
Originally Posted by Dovidhalevi View Post
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.
 
AaronCompNetSys
Old
#9  
Senior Member
Thanks Meter 55
Posts: 179
Join Date: Jun 2007
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
Old
(Last edited by GermainZ; 5th February 2014 at 03:06 PM.)
#10  
GermainZ's Avatar
Forum Moderator / Recognized Developer - OP
Thanks Meter 5604
Posts: 4,951
Join Date: Aug 2012
Update:
Code:
1.1: 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

Quote:
Originally Posted by AaronCompNetSys View Post
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.)

The Following User Says Thank You to GermainZ For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes