PushToTalk - On App termination

How to programmatically leave a channel when an app is forced closed? Currently when a user closes the app, the channel remains active and can still talk via the status bar. However i imagine if a user force closes the app, they no longer want to talk.

I tried implementing this via  func applicationWillTerminate(_ application: UIApplication) { // leave channel code }

but it doesn't seem to work

The PushToTalk framework will maintain an app's PushToTalk channel even after the application is terminated. The framework was designed this way to provide reliability and ensure the PushToTalk channel is maintained even if your PushToTalk app crashes or is terminated for some other reason.

You should encourage your users to use the "Leave" button in the PushToTalk system UI or your own app's user interface to leave the PushToTalk channel. Your app can call the PTChannelManager's leaveChannel(channelUUID:) method to programmatically leave the channel.

good question. you should execute leaveChannel method as background task, cause calling this method wont leave channel

we see the following message in the logs

"PTT leave request completed successfully, should be fulfilled soon" But the channel stays active in system ui. It might be a bug within Push To Talk framework.

By the way When you kill Zello app the channel also removed.

i have managed to run background task on applicationWillTerminate but many time i failed to run background task especially when app is in the suspended (deactive) state. on applicationWillTerminate IOS wont wake your app and you cannot run any operations.

PushToTalk - On App termination
 
 
Q