Post not yet marked as solved
I am writing a Flutter application that uses VoIP notification. I have successfully integrated PushKit natively in iOS and it is invoking CallKit as well.
When the app is minimized and there is an incoming call, there is a call notification with a decline and answer button. It is a native VoIP CallKit Notification.
What I am trying to achieve is, when a user presses either the answer or decline button, I want to detect those button taps for performing some call declining functionality on the Flutter end.
Attaching some code here what I have done so far
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
let handle : String = payload.dictionaryPayload["handle"] as! String
// let uuidString : String = payload.dictionaryPayload["callUUID"] as! String
self.handleCallAndMethods(handle, completion: completion)
}
func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) {
print(callObserver)
print("Call UUID = ")
print(call.uuid)
if call.isOutgoing == false && call.hasConnected == false && call.hasEnded == false {
print("Call has ended")
}
}
func handleCallAndMethods(_ handle : String, completion: @escaping () -> Void){
let config = CXProviderConfiguration(localizedName: "VoIP Service")
config.supportsVideo = true
config.supportedHandleTypes = [.phoneNumber]
config.maximumCallsPerCallGroup = 1
let callProvider : CXProvider = CXProvider(configuration: config)
// callProvider?.setDelegate(callManager, queue: nil)
let uuid : UUID = UUID()
print("Reaching inside call condition")
let callUpdate = CXCallUpdate()
let phoneNumber = CXHandle(type: .phoneNumber, value: handle)
print(phoneNumber)
callUpdate.remoteHandle = phoneNumber
print(callUpdate)
let bgTaskID = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
callProvider.reportNewIncomingCall(with: uuid,
update: callUpdate, completion: { (error) in
self.callObserver.setDelegate(self, queue: nil)
completion()
})
UIApplication.shared.endBackgroundTask(bgTaskID)
}
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
action.fulfill()
print("Answer button is pressed")
}
func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
action.fulfill()
print("Calling is ended")
}
Post not yet marked as solved
When I open developer.apple.com I do not see my other teams on the top right dropdown. After logging in, it directly takes me to one of my teams which is Nautilus and It does not allow me to change to other teams.
Post not yet marked as solved
Hello everyone.
I have mistakenly created a submission version of my application for macOS as well. I want to delete this submission.
I have not added any details in this submission, no screenshots or anything else, even though I have not submitted it for review.
I want to delete this macOS App version.
Post not yet marked as solved
XCode Version: 13.2.1
iOS Version: 15.3.1
I have an apple server setup for sending push notifications, that sends to both Production and Development environments.
It is using certificate-based push, the type of certificate selected is this:
Other than that the code is successfully registering for remote notification returning a unique device token.
Here is the code for registering for notification.
let center = UNUserNotificationCenter.current()
center.delegate = self as UNUserNotificationCenterDelegate
center.requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in
print("Granted \(granted)")
print("Granted \(granted.description)")
if error != nil {
print("Error in permission for notificaiton")
}
if(granted){
print("Permission is granted")
DispatchQueue.main.async {
let settings = UIUserNotificationSettings(types: [], categories: .none)
UIApplication.shared.registerUserNotificationSettings(settings)
UIApplication.shared.registerForRemoteNotifications()
}
} else {
self.deviceToken = "PermissionDenied"
}
}
Here is the registration callback
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken tokenData: Data) {
print("This is unnotification token \(tokenData.hexString)")
deviceToken = tokenData.hexString
}
override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (_ options: UNNotificationPresentationOptions) -> Void) {
print("Handle push from foreground")
// custom code to handle push while app is in the foreground
print("\(notification.request.content.userInfo)")
completionHandler(.alert)
}
override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
print("Handle push from background or closed")
// if you set a member variable in didReceiveRemoteNotification, you will know if this is from closed or background
print("\(response.notification.request.content.userInfo)")
completionHandler()
}
override func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print("This is push notification data \(userInfo)")
// Inform the system after the background operation is completed.
completionHandler(.newData)
}
Here is the server response for sending the notification to the device token provided to it.
None of the callback is receiving the notification payload.
Here is the notification payload:
{
"aps" : {
"alert" : {
"title" : "Game Request",
"body" : "Bob wants to play poker",
},
},
}