-4

I want to capture the event when user put device in the ear(Ex. To hear phone call) and also when user remove device from the ear. Basically i want to capture

  • start time in ear.
  • end time in ear.

Please help.

Ashish
  • 255
  • 1
  • 3
  • 8
  • Your question lacks research. This is not a good fit for SO's question standards. Please visit [help centre](http://stackoverflow.com/help) to find out what kind of questions you should ask here. – DroidDev Jan 30 '15 at 21:31

1 Answers1

-1

Have you tried the Android site, http://developer.android.com/guide/topics/sensors/sensors_motion.html

It sounds like you'll need to use a combo of ACCELEROMETERs and Gyroscopses to detect when the phone is lifted up and rotated to be near the ear.

Dan Anderson
  • 1,062
  • 13
  • 26
  • Hi Dan, I am working on same API you have suggested. I am able to capture the event when we bring device near to the ear. but i want to capture event when device is far from ear. Ex in user pocket. – Ashish Jan 30 '15 at 22:34
  • Do you have an earpiece connected to the phone then? – Dan Anderson Jan 30 '15 at 22:40
  • No, without ear phone only. I am using PROXIMITY sensor(Sensor.TYPE_PROXIMITY). – Ashish Jan 30 '15 at 22:43