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.
- 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.
- 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
Downloads
Current version
AutoLoudspeaker (v1.6)
NotificationIcons
ascertainer's icon, Jack_Surfer's icon
Older versions
AutoLoudspeaker (v1.5) (zip archive)
AutoLoudspeaker (v1.4) (zip archive)
AutoLoudspeaker (v1.3) (zip archive)
AutoLoudspeaker (v1.2) (zip archive)
AutoLoudspeaker (v1.1)
AutoLoudspeaker (v1.0)
Acknowledgments
- Icons are from iconspedia
- Managed service code from Pavel Bánskýs blog
- Code for controlling the loudspeaker from Peter Foots blog
- Creating shortcuts: C# Programming Answers (Answer 2)
- Notifications with custom soft-keys: /dev/mobile - Custom soft keys for Notifications
- The unified sensors API.
- My apologies if I forgot someone...
Any suggestions, remarks are welcome
If you like my work - Buy me a cup of coffee...
Z.
Attachments
-
AutoLoudspeaker.CAB33.9 KB · Views: 608
-
AutoLoudspeaker1.1.CAB50.6 KB · Views: 767
-
AutoLoudspeaker1.2.CAB37.6 KB · Views: 1,168
-
Speaker_256.png25.3 KB · Views: 369
-
AutoLoudspeaker1.3.CAB89.1 KB · Views: 730
-
AutoLoudspeaker1.4.CAB331.2 KB · Views: 1,307
-
AutoLoudspeaker1.5.CAB334 KB · Views: 3,601
Last edited: