Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proximity detection of a specific distance #14

Closed
maxkeppeler opened this issue Oct 22, 2016 · 5 comments
Closed

Proximity detection of a specific distance #14

maxkeppeler opened this issue Oct 22, 2016 · 5 comments
Labels

Comments

@maxkeppeler
Copy link

maxkeppeler commented Oct 22, 2016

In my use case I need to trigger a special event at a customizable distance. The onNear and onFar methods work incredibly good. But the distance, when these are triggers, is too low for my use case.

There are 2 options I thought of.

A onDistance method, which will be triggered at a specific distance, which was defined/ set before.

No additional method, just changing the distance when onNear and onFar are triggered. This is actually my preferred option, since it keeps the behavior of the onNear and onFar methods but the trigger event can be placed at a specific distance. That would be pretty nice.

In my use case, a distance of between (around) 4 -15 cm must be set. Though that distance must be set dynamically.

I hope it's understandable. Thank you very much in advance.
This library is really amazing - fantastic work!

Edited my comment for a better tangibility.

@NielsMasdorp
Copy link

startProximityDetection method can take a float threshold parameter. Isn't that what you mean?

@maxkeppeler
Copy link
Author

Doesn't seem to have any influence on my device. I variegated with the value, but the threshold was still around 2 cm / as without any float value.

@NielsMasdorp
Copy link

Weird, according to the Android Developer documentation the sensor usually returns the distance in cm so calling startProximityDetection(10f, this) should make it trigger at 10cm. Maybe try with a different device?

@maxkeppeler
Copy link
Author

I only have one device, a Nexus 6P. With a float value of 10, the onFar Method is not even triggered anymore. (The onNear method is still triggered, but at the same distance, as without a threshold input at all.)

Which device do you have?

@nisrulz nisrulz added the wontfix label Mar 9, 2017
@nisrulz
Copy link
Owner

nisrulz commented May 7, 2017

Closing this issue as there isn't any direct possible solution to getting proximity updates from the proximity sensor.i.e it's a hardware limitation on what kind of proximity sensor a device has.

A possible solution can be using the camera to measure the distance but that's a far-fetched solution taking into account what the goals of the library are now.

If in future it makes sense, will open up a new issue for the same.

@nisrulz nisrulz closed this as completed May 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants