简体   繁体   English

在后台检测“主页”按钮长按事件

[英]Detect Home button long press event in background

How can I detect Home button long press like 4 second or more event in my app which is already running in background? 如何在已经在后台运行的应用程序中检测到“长按”按钮的长按,例如4秒或更长时间? Is it possible to so because app is already running in background and if user long press home button of the device for 4 second or more can i detect the event in my background running app and if possible than will Apple approve this for app store? 是否可以这样,因为应用程序已经在后台运行,并且如果用户长按设备的主屏幕按钮4秒钟或更长时间,我可以在后台运行的应用程序中检测到该事件吗?如果可能的话,苹果会批准在应用程序商店中使用该事件吗?

No that is not possible. 不,那是不可能的。 As you should know, a long press on the home button brings up Siri. 您应该知道,长按主页按钮会弹出Siri。 Your app would interfere with that. 您的应用会干扰这一点。 Also, I don't believe Apple allows access to the home button event like that. 另外,我不认为Apple允许访问此类Home按钮事件。

Lastly; 最后; while your app is in the background, it goes into a suspend state after a short while and no events run. 当您的应用在后台运行时,不久后便进入了暂停状态,并且没有任何事件在运行。 The only thing the app can do is receive push notifications - unless you have been given special access to audio / gps functions from Apple themselves. 该应用程序唯一能做的就是接收推送通知-除非您从Apple本身获得了对音频/ gps功能的特殊访问权,

Short answer : Not possible. 简短答案:不可能。 not at least with public method and want your app to be on Appstore. 至少不能使用公开方法,并且希望您的应用程序位于Appstore中。

For the Research purpose, you might want to try use private method and do your R&D with it. 出于研究目的,您可能想尝试使用私有方法并使用它进行研发。 it might be possible. 有可能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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