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

Search This thread

zevele

Inactive Recognized Developer
Mar 8, 2010
279
89
Zevele's AutoLoudspeaker v1.6
attachment.php

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.
ChangeLog
  • 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

Downloads

Acknowledgments

Any suggestions, remarks are welcome

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

Z.
 

Attachments

  • AutoLoudspeaker.CAB
    33.9 KB · Views: 608
  • AutoLoudspeaker1.1.CAB
    50.6 KB · Views: 767
  • AutoLoudspeaker1.2.CAB
    37.6 KB · Views: 1,168
  • Speaker_256.png
    Speaker_256.png
    25.3 KB · Views: 369
  • AutoLoudspeaker1.3.CAB
    89.1 KB · Views: 730
  • AutoLoudspeaker1.4.CAB
    331.2 KB · Views: 1,307
  • AutoLoudspeaker1.5.CAB
    334 KB · Views: 3,601
Last edited:

conantroutman

Retired Senior Moderator - XDA Portal Team
Dec 10, 2009
14,182
7,374
hey z,
good to see you round these parts.....
looks like a useful little app, thanks...... :D
 

zevele

Inactive Recognized Developer
Mar 8, 2010
279
89
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...)

Z.
 

tumitumi

Member
Jul 30, 2009
11
0
:confused: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 );)
 

zevele

Inactive Recognized Developer
Mar 8, 2010
279
89
...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 ?...

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.

Z.
 
Last edited:
D

Deleted member 958662

Guest
WOW, very very nice app. I attend this app at least 2 years (since i had the TyTN II)
Thank you very much.

BYE
 

tumitumi

Member
Jul 30, 2009
11
0
Hi,friend, one question before install your good job: if i'm recording the call ( in or out) and Autoloudspeaker is active,if I put away the phone from the ear what happen ? the record will be interrupt or not ?.:rolleyes:
 

zevele

Inactive Recognized Developer
Mar 8, 2010
279
89
if i'm recording the call ( in or out) and Autoloudspeaker is active,if I put away the phone from the ear what happen ? the record will be interrupt or not ?.:rolleyes:

Well, I really don't know what will happen... but I can tell you this, what the application does is simulate a long press on the green button (which toggles the loudspeaker). So if manually switching on and off the loudspeaker doesn't affect your recording I guess my application won't too...

Anyway, if you try let us know the results...

Z.
 

zevele

Inactive Recognized Developer
Mar 8, 2010
279
89
xda-developers downtime

Because of the hardware failure, several posts were lost, here's a sumup according to the email notifications I got and my memory):

sfawzy asked that the application will turn on the speaker according to the G-sensor rather the proximity sensor.

This could be done, but there will be problems - for example, some people use the phone in their car cradle with the same orientation as you hold your phone (upright-portrait)... I could add such a feature with a toggle.

Alanjp3 asked for the starting on boot feature,

This feature will be released with the next release...

Z.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6

    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.
    ChangeLog
    • 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

    Downloads

    Acknowledgments

    Any suggestions, remarks are welcome

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

    Z.
    2
    Version 1.6

    Hi,

    Here is another release (v1.6). I've been using this version for a couple of days and it seems pretty stable...
    I've included altec1000 idea for automatic answer when the proximity sensor is blocked. And I've included the registry keys reported by O2amksin for the Omnia2 (Please let me know if it works).

    Check the changelog on the first post for further information.

    Thanks,

    Z.
    1
    I have a request though. Would it be possible to build a version that runs invisibly and doesn't display a notification or notification icon? Even just a special command line switch to enable this mode would be great.

    You can just uncheck "Use notification" under AutoLoudspeaker settings. This will hide the notification and the notification icon.

    Z.
    1
    Gave me an error when I rebooted the device. Do I have to resize the jpg file? It's about 215 x 210 pixels.

    There are limitations, I don't remember what they are, but I'm pretty sure it has to be an icon (jpg is not good). I don't think the size is the problem. If you'll send me the image I could convert it for you...

    Z.
    1
    ...In the pop-up of your app , the Prox Sensor button is showing disabled . Could you explain why ?

    This has already been discussed (check around pages 13-14). The issue is that HD2 updates the registry with the proximity sensor state, whereas Omnia doesn't (or atleast use different registry keys which I'm not aware of). Therefore AutoLoudspeaker thinks there is no proximity sensor on the device...

    ...I tried calibrating the G-Sensor , but its too sensitive...
    You can always set the values manually - you don't have to use the calibration...

    Z.