How to detect Shake Gesture while application in B

2019-08-06 03:16发布

问题:

I'm currently working on a music player app, and like the iPod application, I would like to shuffle songs with shake gesture.

I'm implementing motion methods like Apple recommends to, and in foreground everything works fine.

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event;

But I just can't figure out how to call those methods from background. I've looked all over the internet, and there's not threads about this.

first things first: is it possible?

Thanx!

回答1:

It's not possible now, whether you use iOS 4 or any lower SDK version.