I want to receive remote control events from Bluetooth Handsfree device, Below mentioned is my set of code for play and pause events.
MPRemoteCommandCenter.shared().nextTrackCommand.isEnabled = true
MPRemoteCommandCenter.shared().previousTrackCommand.isEnabled = true
MPRemoteCommandCenter.shared().nextTrackCommand.addTarget(self, action: #selector(playCommand))
MPRemoteCommandCenter.shared().previousTrackCommand.addTarget(self, action: #selector(previousCommand))
But no such events are triggered. Any help will be appreciated.
You need to call
in
in order to make your application get the desired events.