Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
halll7
Posts: 12
Registered: ‎11-24-2010
My Device: Bold 9900, Torch 9860
Accepted Solution

Proximity Sensor API?

I am developing a VOIP application that will allow user to make calls over their WiFi connection, and this application can be run on touch-enabled devices.

 

One of my development handsets is a Torch 9800 running OS 6. It seems that the proximity sensor is only enabled when the native phone app is running. When I am making VOIP calls using my application, the proximity sensor is not enabled, which leads to accidental UI interaction when the phone is held to the ear.

 

What I would like to do is to enable the proximity sensor when my application is running, but I can find no such API. Is there any way of achieving this? 

Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Proximity Sensor API?

Not that I am aware. If you do a search, you are the only one who has asked this so far and I don't remember it being mentioned at any point for later implementation.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Proximity Sensor API?

I would be interested in this issue as well as i have a call control application that faces similar issues, the proximity sensor only works with the native phone screen.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Proximity Sensor API?

No, there is no third party API for this.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
handle0088
Posts: 27
Registered: ‎06-28-2011
My Device: 9800

Re: Proximity Sensor API?

Same problem with me
Contributor
halll7
Posts: 12
Registered: ‎11-24-2010
My Device: Bold 9900, Torch 9860

Re: Proximity Sensor API?

It turns out that there is an API for the proximity sensor, although it wasn't easy to find! It's been there since OS6 - I've got it working on a Bold 9900 running OS7. Here's the code to enable the proximity sensor for your app:

 

final InputSettings proximitySettings = TouchscreenSettings.createEmptySet();
proximitySettings.set(TouchscreenSettings.DETECT_FACE_PROXIMITY, 1); //1=enabled
app.getUiEngineInstance().addInputSettings(proximitySettings);


 Link to javadocs:

 

http://www.blackberry.com/developers/docs/6.0.0api/index.html?net/rim/device/api/ui/input/Touchscree...

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Proximity Sensor API?

good to see it confirmed and tested, i have seen the flag, but did not have the time to test it myself.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
handle0088
Posts: 27
Registered: ‎06-28-2011
My Device: 9800

Re: Proximity Sensor API?

It is really a good news