flutter_voip_push_notification
flutter_voip_push_notification copied to clipboard
Receive notifications on Background and when app is killed
Hi, please help em, all is working on foreground, but when app is on Background method onResume method kill app, another question, I need show notification alert when app is killed, how I can do this?
This plugin does not work for normal notifications. When using PushKit apps must report a system call otherwise iOS will kill your app after a while.
i has same issues
This plugin does not work for normal notifications. When using PushKit apps must report a system call otherwise iOS will kill your app after a while.
How to test app with VoIP push . I want move further only if it is working . Is there any website or something to test this. ..?
This plugin does not work for normal notifications. When using PushKit apps must report a system call otherwise iOS will kill your app after a while.
I want to show notification like uber driver notification. What I need to do in this case. Please give enlighten me with some details
I had same issue and solved it
import UIKit
import PushKit
import flutter_voip_push_notification
import flutter_call_kit
import CallKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate ,PKPushRegistryDelegate{
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
NSLog("didUpdatePushCredentials: \(pushCredentials.token)")
// Process the received push
FlutterVoipPushNotificationPlugin.didUpdate(pushCredentials, forType: type.rawValue);
}
func pushRegistry(_ registry: PKPushRegistry,
didReceiveIncomingPushWith payload: PKPushPayload,
for type: PKPushType,
completion: @escaping () -> Void) {
let uuid = NSUUID().uuidString
let handle = "+819011111111"
let callerName = "Robert"
FlutterCallKitPlugin.reportNewIncomingCall(uuid, handle: handle, handleType: "generic", hasVideo: false, localizedCallerName: callerName, fromPushKit: true)
// Process the received push
FlutterVoipPushNotificationPlugin.didReceiveIncomingPush(with: payload, forType: type.rawValue)
completion()
}
}
Add this code in your AppDelegate.swift Send Voip Notification from server . If your backend works in Nod Js , fine solution here
Thank you for your solution. Is there any way I can pass caller name send from voip push notification to show on callkit
I had same issue and solved it
import UIKit import PushKit import flutter_voip_push_notification import flutter_call_kit import CallKit import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate ,PKPushRegistryDelegate{ func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) { NSLog("didUpdatePushCredentials: \(pushCredentials.token)") // Process the received push FlutterVoipPushNotificationPlugin.didUpdate(pushCredentials, forType: type.rawValue); } func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { let uuid = NSUUID().uuidString let handle = "+819011111111" let callerName = "Robert" FlutterCallKitPlugin.reportNewIncomingCall(uuid, handle: handle, handleType: "generic", hasVideo: false, localizedCallerName: callerName, fromPushKit: true) // Process the received push FlutterVoipPushNotificationPlugin.didReceiveIncomingPush(with: payload, forType: type.rawValue) completion() } }Add this code in your AppDelegate.swift Send Voip Notification from server . If your backend works in Nod Js , fine solution here
I don’t think you can that with this library . But it my be possible my modifying it. My requirement was to show a fixed Name . so i didn’t try for that .
Thank you dear for your reply
@ziasultan2 Yes you can get all the info from the payload that you sent over from your server
Overview
- when you recieve a voip notification parse the notification
- if the notification is good, tell callkit to start the call
- you can fill in the call details from the payload you get from the server
Objective-C
NSString *localizedName = payload[@"identifier"];
Swift
guard let localizedName = payload["identifier"] as? String else { return }
I would look at VoxImplants CallKit README for more details
I had same issue and solved it
import UIKit import PushKit import flutter_voip_push_notification import flutter_call_kit import CallKit import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate ,PKPushRegistryDelegate{ func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) { NSLog("didUpdatePushCredentials: \(pushCredentials.token)") // Process the received push FlutterVoipPushNotificationPlugin.didUpdate(pushCredentials, forType: type.rawValue); } func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { let uuid = NSUUID().uuidString let handle = "+819011111111" let callerName = "Robert" FlutterCallKitPlugin.reportNewIncomingCall(uuid, handle: handle, handleType: "generic", hasVideo: false, localizedCallerName: callerName, fromPushKit: true) // Process the received push FlutterVoipPushNotificationPlugin.didReceiveIncomingPush(with: payload, forType: type.rawValue) completion() } }Add this code in your AppDelegate.swift Send Voip Notification from server . If your backend works in Nod Js , fine solution here
The application not crashing for me but no notification receiving in the background.But,It works in foreground.
here App crashed with error message below reason: '-[CXProviderConfiguration initWithLocalizedName:]: parameter 'localizedName' cannot be nil'