简体   繁体   中英

Detect fast double power button press

Is it possible to detect if the user pressed the power button two times fast? Apple use the way to confirm an Appstore purchase on the new iPhone X with Face-ID. Is there any API available? Want to use it in an similar case for authenticate via Face-ID.

应用商店确认 iPhone X

No. The system itself controls response to the side (sleep/wake/power) button.

iOS accepts a double-tap on side button to prompt for Face ID authentication only during an Apple-mediated financial transaction — that is, to make a purchase from iTunes / App Store, including in-app purchases, or to complete an online Apple Pay transaction. Outside such circumstances, double-tapping the side button either brings up the UI for an in-person Apple Pay transaction or (if the setting for showing Wallet on double-tap is disabled) does nothing.

Your app is welcome to prompt for Face ID / Touch ID authentication in response to any in-app or on-screen event, but not only is there no API explicitly for responding to the side button or other hardware controls, any attempt to repurpose existing API for such reasons probably wouldn't get past App Review :

2.5.9 Apps that alter or disable the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, or other native user interface elements or behaviors will be rejected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM