• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Use proximity sensor to disable screen while in pocket

Status
Not open for further replies.
While the service is active it turns the screen off every time when something's near and turns it back on when far. It neither does poll nor run anything. When turned on, it just "aquires" a PowerManager.WakeLock (PROXIMITY_SCREEN_OFF_WAKE_LOCK (32)). Turning it off, that WakeLock will be released. Task Killer users should check their settings and append this to the exception list of course.

The service can be found here: (old link removed)
http://proximitytoolextension.googlecode.com/files/ProximityTool.apk

You use it of course on your own responsibility :).

Hi, tried it now on ADW Launcher rooted with Cyanogenmod for Nexus 6.1.0 Froyo 2.2.1 but won't work, actually as the proximity sensor didn't have reaction from your code if couldn't override CM settinds. I saw it in earlier version or before CM, specialy to switch the screen off while charging it, but setting disappeared. At the moment using solution Clock -> Sun symbol to disable it but comes back with small touch of the screen, so wouldn't be solution for you. I'd prefer your code updated anyway if possible. You can email me to vladoko@gmail.com.. Thanks
 
Upvote 0
Okay, I implemented the change now. General proximity sensing and screen toggling only active when headset plugged in. Headset presence is automatic of course (using BroadcastReceiver events). No further battery usage. You can still have the general screen toggling version if you use this file name in the link: ProximityTool.general.apk

Tried using ProximityTool.general.apk in the link but it appears you have removed this file. Please could you re-post it? as i don't use a headset.
By the way, Ur app Rocks!!
 
Upvote 0
I do not understand this restriction is not an android, or who do not need?
Nowhere is there utility to lock the device on the sensor approach, so
so that when closed proximity does not allow to wake up? And if you call just to put out the screen and block after the conversation, if before the call was blocked.
Widgets for blocking a single click is complete, and there is no such.
Ready to fill up to someone from the mobile phone)
The problem for dizaere when talking on the bluetooth and wired headset (the screen is activated proximity sensor does not extinguish), and so he wakes up by itself sometimes.
 
Upvote 0
Found a different link on HTC Forums, this time to a different place. The link doesn't work as-is, but if you omit the filename you can browse the folder and hey-presto! the file is there, but has been renamed with an .old extension.

Use at your own risk...

http://androidforums.com/htc-desire/...

Jeeez :-D
Well. The file's extension is changed because the code is hosted here:
Downloads - proximitytoolextension - hu.copas.android.tools.ProximityTool - Google Project Hosting
Of course there is not much risk there since the source is also available in the download section.

I checked back here because I flashed my Desire with LeeDroid's Gingerbread edition. This works even better with the general version of this tool which means Google has improved their wakelock service (which this very simple proglram is using). If you manually lock the screen, the general tool does not bring it back.

My actual problem is still with the incoming lock screen of the HTC dialer. When it starts to ring, I try to take it out of my pocket but I cancel the call because my leg moves the slider towards the cancel direction. I simply hate it...
So the very first thing I'll try to do now is to activate the service only in the moment a call comes in. This prevents an accidental cancel or early pick up.

Bye for now :)
 
Upvote 0
Copas2, thanks a lot for this tool! If you would have a donate button I'd buy you a beer :)

This fixes one of the minor flaws of the Desire S (or any Android phone?).

It would rock if you could make the service start up after booting the phone. Unbelievable that you can't do that out of the box in Android (hell, even windows 3.1 had a start up folder...).
 
Upvote 0
Hmm, it looks like I was a little too optimistic.

I noticed the screen turns on when making a call via the bluetooth kit in my car, so I can still accidently disconnect. This happens when I initiate the call myself.
When I receive a call the screen also turns on when I answer the call...

Still an improvement over the standard behaviour though!

Can it be because of Gingerbread?
 
Upvote 0
I've made it all new and against Android 2.3.3 (GingerBread)
Downloads - proximitytoolextension - hu.copas.android.tools.ProximityTool - Google Project Hosting
This new service activates proximity sensing and thereby tilting disabling and turning the screen off only when the device is locked. It means that it doesn't disturb you while poking around purposely on the phone but while locked, it tilts the screen always when something's near the sensor (phone is in pocket, etc). This is achieved by two events: ACTION_SCREEN_OFF and ACTION_USER_PRESENT.
Tested only on Android 2.3.3 (GingerBread)
 
  • Like
Reactions: Fishyweb
Upvote 0
I believe you are using the wrong word.

From dictionary.com, tilt has several meanings, none of which seem to apply to this situation:
1. to cause to lean, incline, slope, or slant.
2. to rush at or charge, as in a joust.
3. to hold poised for attack, as a lance.
4. to move (a camera) up or down on its vertical axis for photographing or televising a moving character, object, or the like.

Do you perhaps mean "disable" instead of "tilt"?
 
Upvote 0
I believe you are using the wrong word.

From dictionary.com, tilt has several meanings, none of which seem to apply to this situation:
1. to cause to lean, incline, slope, or slant.
2. to rush at or charge, as in a joust.
3. to hold poised for attack, as a lance.
4. to move (a camera) up or down on its vertical axis for photographing or televising a moving character, object, or the like.

Do you perhaps mean "disable" instead of "tilt"?
Yeah, sorry, thanks :)
We have the exact same word for disabling and I didn't seem to pay attention. Disabling is the correct one here.
 
Upvote 0
Status
Not open for further replies.

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones