Custom remote event handling in app from iOS lock screen
Asked Answered
F

1

7

How does spotify handle custom remote events? Currently on iPhone 6 running iOS 8.1.3 and spotify version 2.4.0.1822 I get the following controls on the lock screen when I turn on spotify radio. Ive tried reading all docs pertaining to remote events, and I'm unable to find any resources which allow custom remote events from the lock screen.

enter image description here enter image description here

Feathercut answered 23/2, 2015 at 15:56 Comment(0)
D
6

Maybe that is implemented with MPRemoteCommandCenter. Here is example...

MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[[remoteCommandCenter skipForwardCommand] addTarget:self action:@selector(skipForward)];
[[remoteCommandCenter togglePlayPauseCommand] addTarget:self action:@selector(togglePlayPause)];
[[remoteCommandCenter pauseCommand] addTarget:self action:@selector(pause)];
[[remoteCommandCenter likeCommand] addTarget:self action:@selector(like)];

Implement this code, play music on your app, and lock your iPhone. You will probably see a customized lock screen.

Note - Menu can be customized label, but it can not customize icon image and number of row.

Dag answered 25/3, 2015 at 16:50 Comment(1)
@kalpa Simulator doesn't support Control Center now. So, you can not see this function on Simulator.Dag

© 2022 - 2024 — McMap. All rights reserved.