Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP GermainZ

3rd February 2014, 10:41 AM   |  #1  
GermainZ's Avatar
OP Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,330
 
5,909 posts
Join Date:Joined: Aug 2012
Donate to Me
More
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.2.1: The widget now uses images to indicate the module's state. This should fix text getting cut off on some devices.
1.2: 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).
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.
Last edited by GermainZ; 23rd September 2014 at 07:15 PM.
The Following 25 Users Say Thank You to GermainZ For This Useful Post: [ View ]
3rd February 2014, 11:12 AM   |  #2  
Senior Member
Thanks Meter: 1,014
 
2,131 posts
Join Date:Joined: 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
3rd February 2014, 11:18 AM   |  #3  
GermainZ's Avatar
OP Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,330
 
5,909 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Quote:
Originally Posted by Dovidhalevi

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 by GermainZ; 3rd February 2014 at 11:23 AM.
3rd February 2014, 01:10 PM   |  #4  
Andrev01's Avatar
Senior Member
Flag Gliwice
Thanks Meter: 55
 
781 posts
Join Date:Joined: Nov 2012
More
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?
3rd February 2014, 01:31 PM   |  #5  
GermainZ's Avatar
OP Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,330
 
5,909 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Quote:
Originally Posted by Andrev01

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: [ View ]
3rd February 2014, 01:36 PM   |  #6  
StraightEdgeKid's Avatar
Senior Member
Flag Pune
Thanks Meter: 80
 
349 posts
Join Date:Joined: Feb 2012
More
Good app, was looking for something like this since long.

sent from public phone using coins.
3rd February 2014, 05:46 PM   |  #7  
Senior Member
Thanks Meter: 1,014
 
2,131 posts
Join Date:Joined: 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.
3rd February 2014, 05:54 PM   |  #8  
GermainZ's Avatar
OP Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,330
 
5,909 posts
Join Date:Joined: Aug 2012
Donate to Me
More
Quote:
Originally Posted by Dovidhalevi

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 by GermainZ; 3rd February 2014 at 05:57 PM.
4th February 2014, 11:29 PM   |  #9  
Senior Member
Thanks Meter: 55
 
185 posts
Join Date:Joined: 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.
5th February 2014, 04:01 PM   |  #10  
GermainZ's Avatar
OP Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,330
 
5,909 posts
Join Date:Joined: Aug 2012
Donate to Me
More
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

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 by GermainZ; 5th February 2014 at 04:06 PM.

The Following User Says Thank You to GermainZ For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes