Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically send a remote control event in iOS

I want to trigger a remote control event such as UIEventSubtypeRemoteControlTogglePlayPause programatically. The application that I have in mind is a voice remote control application (even if it already exists) which receives the command "Play" and it simply generates the event UIEventSubtypeRemoteControlTogglePlayPause. Any app registered as the first responder for this event will get it. I.e. my app simply translates voice to remote control commands.

Ideas?

like image 745
Coozy J Avatar asked Sep 26 '13 04:09

Coozy J


1 Answers

It's not possible to generate UIEvents programmatically.

You can do it by using private API (google synthesize UIEvent). Some testing frameworks do that. Also, for testing, you can inject Apple's UI Automation framework into the application and use its method to generate events (mostly touch events, headers available on github).

However, synthesizing events is something you can't do in an Appstore application. If you need to do that, it's a bad design.

like image 56
Sulthan Avatar answered Oct 27 '22 01:10

Sulthan