Detect fast double power button press

前端 未结 1 571
别那么骄傲
别那么骄傲 2021-01-16 23:24

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 an

相关标签:
1条回答
  • 2021-01-17 00:17

    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.

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