ios_communication_notification

Last updated:

0 purchases

ios_communication_notification Image
ios_communication_notification Images
Add to Cart

Description:

ios communication notification

iOS Communication Notifications #

Ref: Apple Docs

Screenshots: #



Features #

support show communication notifications on ios 15 or above
support callback onclick notification

Configuration #

Install package

flutter pub add ios_communication_notification
copied to clipboard
flutter clean && flutter pub get
copied to clipboard


Config XCode


Capabilities


Open your Project in XCode.
Click on Runner, then Target Runner
Click on Signing & Capabilities
Add Capability
Add Communication Notifications


Info.plist


Open Info.plist
Add NSUserActivityTypes as type array
Add INSendMessageIntent as the element of the newly created array



Config AppDelegate Extension


Open AppDelegate.swift
Copy the below piece of code and add it at the end of the file

import UIKit
import ios_communication_notification

extension AppDelegate {
override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
if #available(iOS 15.0, *) {
if (notification.request.identifier.starts(with: IosCommunicationConstant.prefixIdentifier)) {
completionHandler([.banner, .badge, .sound, .list])
}
}

return super.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler)
}

override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {

if #available(iOS 15.0, *) {
if (response.notification.request.identifier.starts(with: IosCommunicationConstant.prefixIdentifier)) {
let userInfo = response.notification.request.content.userInfo

IosCommunicationNotificationPlugin.shared.onClickNotification(userInfo)

completionHandler()
}
}

return super.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
}
}
copied to clipboard
Usage #

Check available for show communication notifications

// if iOS 15 or above
final bool isAvailableForCommunication = await IosCommunicationNotification().isAvailable();
copied to clipboard

Show notification

IosCommunicationNotification().showNotification(
NotificationInfo(
senderName: "lambiengcode",
imageBytes: imageBuffer,
value: "This is payload, will receive when click this notification",
content: "Hello Flutter"
),
);
copied to clipboard

Get initial payload - useful for check and get payload if app start from click communication notification

IosCommunicationNotification().getInitialPayload().then((payload) {
// TODO: do somethings
});
copied to clipboard

Set onClick callback function

IosCommunicationNotification().setOnClickNotification((payload) {
// TODO: do somethings
});
copied to clipboard
ReactionBoxParamenters #



parameter
description
default




senderName
Title of notification - sender message notification
required


imageBytes
Avatar of sender
required


content
Message content
required


value
Payload notification
required



Download Askany #




License - lambiengcode #
MIT License

Copyright (c) 2022 Askany

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.