Can MPRemoteCommandCenter listen to custom events other than playing or pausing audio,video?

162 Views Asked by At

I have an app will run in the background. I think it's gonna be very convenient for my users if they are allowed to stop the background service on lock screen. Otherwise they will have to unlock the phone first and locate my app from all apps they installed then open up my app to tap the stop button(too many steps).

However I have not found any method to implement this demand except the MPRemoteCommandCenter. But MPRemoteCommandCenter can only work with music or video play as far as I know. I am wondering if it is possible to ask the MPRemoteCommandCenter to listen to a custom event and allow users to start or stop a function of an app.

I know probably I ask too much for MPRemoteCommandCenter because this seems can be over used by developers and produce too many unnecessary remote controls on lock screen. So I am also looking for other ways to meet my demand, a standard approach for this kind of task. Is it a good idea that post a notification on lock screen once my background service starts. So users can tap the notification on lock screen and open up my app immediately(it needs the authorization for notification though).

1

There are 1 best solutions below

0
On

I think I can answer my own question now. The correct solution for my demand should be widgets