iPhone Proximity Sensor

后端 未结 13 1781
感动是毒
感动是毒 2020-12-01 00:47

Can the iPhone SDK take advantage of the iPhone\'s proximity sensors? If so, why hasn\'t anyone taken advantage of them? I could picture a few decent uses.

For examp

相关标签:
13条回答
  • 2020-12-01 01:35

    @Dipak Patel & @Coderer

    You can download working code at http://spazout.com/google_cheats_independent_iphone_developers_screwed

    It has a working implementation of proximityStateChanged a undocumented method in UIApplication.

    Hope this helps.

    0 讨论(0)
  • 2020-12-01 01:36

    Evidently the proximity sensor will never turn on if the status bar is in landscape orientation. i.e, if you call:

    [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
    

    You will no longer get the proximity:ON notifications.

    This definitely happens on OS 3.0, I can't test it on a 2.X device since I don't have one with a proximity sensor.

    This seems like a bug.

    0 讨论(0)
  • 2020-12-01 01:40

    In iPhone 3.0 there is official support for the proximity sensor. Have a look at UIDevice proximityMonitoringEnabled in the docs.

    0 讨论(0)
  • 2020-12-01 01:41

    There is no public API for this.

    0 讨论(0)
  • 2020-12-01 01:42

    There is a public API for this. -[UIApplication setProximitySensingEnabled:(BOOL)] will turn the feature on. BTW, it doesn't seem to be using the light sensor, because proximity sensing would tweak out in a dark room.

    However, the API call basically blanks the screen when you hold the phone up to your face. Not useful for interaction, sadly.

    0 讨论(0)
  • 2020-12-01 01:46

    If you aren't aiming for the AppStore, you can read my articles here on getting access to those:

    Proximity Sensor: http://iphonedevwiki.net/index.php/AppleProxShim

    Ambient Light Sensor: http://iphonedevwiki.net/index.php/AppleISL29003

    0 讨论(0)
提交回复
热议问题