Questions tagged [proximitysensor]

One of the several sensors present on an Android device

The proximity sensor detects when the user is holding the phone close to his/her ear and either shuts off or locks the screen so he/she don't accidentally hang up the call.

Reference page for sensors: http://developer.android.com/reference/android/hardware/Sensor.html

117 questions
37
votes
9 answers

Disable Proximity Sensor during call

I dropped my phone and looks like my proximity sensor no longer works reliably. It returns Near all the time. The problem is, the display turns off during call and I wont be able to use the number pad to enter pin or conference another call, or even…
16
votes
5 answers

Keep display on when the proximity sensor is covered

I want to intercept the proximity sensor without turning off the display. I know by the documentation that I have two Bool variables: proximityMonitoringEnabled proximityState and this code [UIDevice currentDevice].proximityMonitoringEnabled =…
Simone Pistecchia
  • 2,746
  • 3
  • 18
  • 30
12
votes
1 answer

How to take a picture using the proximity sensor?

I am having trouble getting the device to take an image using the rear view camera when the proximity sensor is enabled. I don't want the camera preview to show up, just want the device to take the photo and present it in the imageView. I have the…
D.Khan
  • 143
  • 1
  • 6
11
votes
1 answer

How to use proximity sensor programmatically with iOS development?

After some googling, I can understand that the "proximity sensor" which is used to on/off screen when the device is away/near from the user. I watched this video (watch from 30th sec) and surprised about this cool stuff. I want to implement it in my…
Confused
  • 3,846
  • 7
  • 45
  • 72
11
votes
0 answers

Detect if the phone is in pocket or not

This question is not exactly about code but rather implementation. I am working on an app that requires to check if the phone is in pocket or not. I have a simple algorithm to detect user steps when walking. The problem is movement in hand can also…
Dumbo
  • 13,555
  • 54
  • 184
  • 288
10
votes
1 answer

Android proximity sensor issue only in Samsung devices

Specific scenario to avoid problems: Behaviour for Activity in Samsung devices was different in the manner that every time there was a change detected, for proximity, it resulted in a call to onPause()/onResume() ONLY on SAMSUNG devices. I was…
Pararth
  • 8,114
  • 4
  • 34
  • 51
7
votes
3 answers

UnregisterListener doesn't work with PROXIMITY_SCREEN_OFF_WAKE_LOCK

I have this code public class MainActivity extends AppCompatActivity implements SensorEventListener { private SensorManager mSensorManager; private Sensor mProximity; private PowerManager mPowerManager; private PowerManager.WakeLock…
Cabezas
  • 9,329
  • 7
  • 67
  • 69
7
votes
2 answers

How to get current value of Android's proximity sensor?

Is it possible to get the current value of the Proximity Sensor in Android? I know that I can use SensorManager and Sensor and register a state changed listener, but I have no need to be notified of every state change, so it would be highly…
6
votes
5 answers

Proximity Sensor is not working in iPhone 4 device

//I have created below snippet to let the sensor to be detected. -(void)addProximitySensorControl { UIDevice *device = [UIDevice currentDevice]; device.proximityMonitoringEnabled = YES; BOOL state = device.proximityState; …
Kuldeep
  • 2,589
  • 1
  • 18
  • 28
6
votes
2 answers

iOS Objective-C Turn off Proximity Monitoring while VoiceOver is active

I would like to disable Proximity Monitoring, so that screen remains always ON, not matter how close something is to the sensor. I tried it by using: UIDevice.currentDevice.proximityMonitoringEnabled = NO; Normally it is working as expected,…
Dombi Bence
  • 746
  • 7
  • 23
6
votes
0 answers

Proximity sensor strange operation iOS

I am developing an application that requires the proximity sensor constantly active during execution. I put this code in the app delegate: [UIApplication sharedApplication].idleTimerDisabled = YES; [UIDevice currentDevice].proximityMonitoringEnabled…
Francesco
  • 61
  • 3
5
votes
1 answer

onAccuracyChanged, why?

this is one of the auto-generated functions I get when implementing SensorEventListener i've searched and didn't find anymore than this description: "Do something if sensor accuracy changes." when and how does the proximity sensor accuracy…
Motassem Kassab
  • 1,744
  • 4
  • 21
  • 40
5
votes
0 answers

Unexpected false return value from android.hardware.SensorManager.registerListener in Android 4.3

Used LG Nexus 4, Android 4.3 The return value is sometimes false and I don't understand why. Documentation says: "true if the sensor is supported and successfully enabled." What is strange is that no examples I've seen is testing return value from…
5
votes
2 answers

How to change the shape of a Geofence

The new Location API in Google allows for creating and monitoring a Geofence that's a circular region with the Geofence.Builder class. This class only has methods defined for creating a geofence with a circular shape. I was wondering if it was…
4
votes
1 answer

Android: addProximityAlert LocationManager Method doesn't send Broadcast

I'm working on an Android Project where i'm using AddProximityAlert method, as you already know this method let you set a proximity alert for the location given by the position (latitude, longitude) and the given radius, and notify you if you are so…
Mouad EL Fakir
  • 3,609
  • 2
  • 23
  • 37
1
2 3 4 5 6 7 8