[App] Zevele's AutoLoudspeaker V1.6 [15/01/2011]

279 posts
Thanks Meter: 89
By zevele, Inactive Recognized Developer on 20th September 2010, 10:45 PM
Post Reply Email Thread


Hi, I've stumbbled upon sfawzy request of an application that will automatically turn on the loudspeaker when the phone is away from the ear, and turns it off when it is near the ear. I really liked the idea and this is the result.
AutoLoudspeaker is fairly simple to use. When running the application a service starts. If the shortcut is pressed again, a notification message pops and the user can choose to close the service. As long as the service runs the loudspeaker will automatically switch on if the proximity sensor is unblocked and off if it is blocked (only during an active phone call).
I wrote the application and tested it on my HTC HD2, so I can't say how it will operate on other devices...

Main features:
Switch the loudspeaker according to the proximity-sensor or g-sensor.
Answer an incoming call by gesture (wave your hand in front of the proximity-sensor).

Known issues
  • Non at the moment (I'm sure some will pop soon... )

Future improvements
  • Fade in volume when turning on the speaker (Couldn't find a way to change the in-call volume - any suggestions are most welcome).
  • Recognize gestures to manually turn on/off the speaker. Currently the sampling frequency of proximity sensor is too slow. If I'll find a way to sample the sensor faster it might be feasible.
  • Change the shortcut's icon while AutoLoudspeaker is running (I didn't find a way to do this, if anyone has a clue please tip me...).
  • Shake phone to answer (let me know how do you feel about such a feature).

System Requirements
  • .Net Compact Framework 3.5
  • Tested successfully on: HTC HD2 (Leo), HTC TP2 (Rhodium), HTC miniHD (Photon), HTC TD2 (Topaz), HTC Whitestone (Imagio).
  • Proximity sensor and/or g-sensor.
  • 15/01/11 (v1.6) (starting at post #177)
    • Add ability to automatically answer a call when the proximity sensor is blocked (altec1000's request). This feature can be set by selecting the "Block" gesture in the settings window. The gesture first waits for the sensor to be unblocked for a certain amount of time, after which it checks that the sensor is blocked for a second period of time - only if both periods were fulfilled AutoLoudspeaker will answer the call.
      Two registry keys were added:
      • BlockGestureOpenDelay - Sets the minimum period (in msec) the sensor has to be unblocked before checking the block status.
      • BlockGestureBlockDelay - Sets the minimum period (in msec) the sensor has to be blocked before answering the call.
    • Add command-line controls (to Start/Stop the service). Two commands are available:
      • quit - Stops the serivce.
      • update - Force AutoLoudspeaker to reread the settings from the registry.
    • Changed the notification behavior. Now pressing the notification immidiatly brings the Settings application.
    • I've included the proximity-sensor registry keys of Omnia2 reported by O2amksin. I don't own an Omnia2 device so I don't know if it did the trick...
    • Some minor code and gui changes.
  • 12/10/10 (v1.5) (starting at post #106)
    • Reverted to the polling method of v1.3 for the Proximity-Sensor (it just works better). This should also solve the exception on devices with no proximity sensor.
    • Fixed issue where AutoLoudspeaker failed to create a shortcut in a non-english localizations.
    • Fixed issue where the notification icon remained visible when the service was closed from the settings application.
    • Fixed an issue where the delay occurred also before turning the speaker off (instead of just before turning it on).
    • Added a short vibration before changing the loudspeaker state.
      The vibration length can be set via the registry value: HKCU\Software\AutoLoudspeaker\VibrationLength (default: 20ms).
      The vibration LED index can be set via the value: HKCU\Software\AutoLoudspeaker\VibrationLED (default: 1 - this is the one for the HD2).
    • If proximity sensor is not detected (it's registry keys are missing) the possibility to select the proximity method is disabled in the settings application.
    • Some performance improvement for the "managed service" code.
  • 02/10/10 (v1.4) (starting at post #106)
    • Fixed issue where AutoLoudspeaker remained active when missed call occurred.
    • Fixed issue where speaker was turned on when facing down - event if "Speaker on when facing down" was unchecked.
    • Fixed default angles for the g-sensor method.
    • Allow to override notification icon. To use a custom icon, put a new icon named "NotificationIcon.ico" under the installation folder.
    • Added a toggle to remove the notification altogether.
    • Changed method of reading the proximity-sensor values. Now using "RegistryState" instead of polling the registry key.
    • Split the settings dialog to a different executable.
    • Added the ability to start/stop the Service form the settings application (under the about tab).
    • Added some text to the g-sensor calibration screen.
  • 29/09/10 (v1.3) (starting at post #46)
    • Changed the icon.
    • Answer on gesture - slowly passing your hand over the proximity sensor, will answer the incoming call.
    • Replaced the message-boxes with notifications. In addition, notification on startup is iconic an quiet - so no more annoying message-boxes on startup.
    • Added a short delay before turning the speaker on, so if the phone is momentarily way from the ear it wont turn the speaker on.
    • Added the possibility to use the g-sensor instead of the proximity sensor. Now you can define two pairs of angles between which the speaker is off.
    • Added a configuration & about dialog. To open the dialog press the notification or run the application again and touch "settings".
      The dialog include:
      • Toggle load Autoloudspeaker on startup.
      • Answer on gesture.
      • Turn on speaker when facing down.
      • Set the delay before turning the speaker on.
      • Select the sensing method (proximity- or g-sensor).
      • Configuring the angles for the g-sensor method.
      • About tab.
  • 24/09/10 (v1.2) (starting at post #19)
    • Converted to "managed service".
    • Now application does not close when ActiveSync is connected.
    • Removed the applications main form.
    • If AutoLoudspeaker does not run, pressing the shortcut starts the service (and gives an appropriate message). If AutoLoudspeaker already runs a message box pops and the user can select to close the service or to keep it running.
  • 22/09/10 (v1.1)
    • Now works both with outgoing and incoming calls.
    • When proximity sensor is blocked and the phone face down, the speaker will turn on.
    • Some more minor changes (cleaning the code, some typos etc.)
  • 20/09/10 (v1.0) - Initial release

Any suggestions, remarks are welcome

If you like my work - Buy me a cup of coffee...

Attached Thumbnails
Click image for larger version

Name:	Speaker_256.png
Views:	339
Size:	25.3 KB
ID:	409895  
Attached Files
File Type: cab AutoLoudspeaker.CAB - [Click for QR Code] (33.9 KB, 600 views)
File Type: cab AutoLoudspeaker1.1.CAB - [Click for QR Code] (50.6 KB, 761 views)
File Type: cab AutoLoudspeaker1.2.CAB - [Click for QR Code] (37.6 KB, 1162 views)
File Type: cab AutoLoudspeaker1.3.CAB - [Click for QR Code] (89.1 KB, 722 views)
File Type: cab AutoLoudspeaker1.4.CAB - [Click for QR Code] (331.2 KB, 1300 views)
File Type: cab AutoLoudspeaker1.5.CAB - [Click for QR Code] (334.0 KB, 3588 views)
The Following 6 Users Say Thank You to zevele For This Useful Post: [ View ] Gift zevele Ad-Free
20th September 2010, 10:53 PM |#2  
conantroutman's Avatar
Retired Senior Moderator - XDA Portal Team
Thanks Meter: 7,551
hey z,
good to see you round these parts.....
looks like a useful little app, thanks......
21st September 2010, 12:35 AM |#3  
Thanks Meter: 3
Great Great work !!
Thank you
I will try it ..
21st September 2010, 09:07 AM |#4  
troed's Avatar
Senior Member
Flag Vienna
Thanks Meter: 125
Very good idea !

Will give it a try

EDIT: BTW, does this also work on HTC Touch HD Blackstone (dunno if this one has a sensor though ?)
21st September 2010, 06:50 PM |#5  
zevele's Avatar
OP Inactive Recognized Developer
Thanks Meter: 89
Donate to Me
Originally Posted by troed

BTW, does this also work on HTC Touch HD Blackstone (dunno if this one has a sensor though ?)

I guess it can't work as is (because of the slight deficiency in the proximity sensor department), but maybe I could use the light sensor instead of the proximity sensor (not sure how good it will work though...)

22nd September 2010, 03:48 AM |#6  
Junior Member
Thanks Meter: 0
Good cab ! I don't try yet but i don't understand one thing : is it posible active it on demand ? an other words can we choose if active it or not ? or when it's installed work always ? ( sorry for my bad inglish )
22nd September 2010, 07:30 AM |#7  
zevele's Avatar
OP Inactive Recognized Developer
Thanks Meter: 89
Donate to Me
Originally Posted by tumitumi it posible active it on demand ? an other words can we choose if active it or not ? or when it's installed work always ?...

The short answer:
Yes. it can be activated on demand...

The long answer:
It works as long as the application is running... that is, when you start the application (from the start menu) the main form appears, then you can minimize the application (by pressing the minimize button). To close the application you click it's shortcut again (in the start menu), so the main from is restored, the press the close button, and the application closes.

22nd September 2010, 03:35 PM |#8  
Junior Member
Thanks Meter: 0
does it work with bluetooth headset???
22nd September 2010, 10:19 PM |#9  
zevele's Avatar
OP Inactive Recognized Developer
Thanks Meter: 89
Donate to Me
Originally Posted by betterend

does it work with bluetooth headset???

I depends what do you mean by "work". From my testings, when headset is connected the loudspeaker is disabled. So it won't turn on the loudspeaker. This is the behavior I'd expect for the application...

23rd September 2010, 04:18 AM |#10  
Senior Member
Thanks Meter: 303
Works with Touch Pro 2
23rd September 2010, 05:55 AM |#11  
paul.p's Avatar
Flag Tulsa, OK
Thanks Meter: 10
nice app...seems to work just fine on my hd2...thanks
Post Reply Subscribe to Thread

g-sensor, loudspeaker, proximity sensor

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes