infobip_mobilemessaging 10.0.0
infobip_mobilemessaging: ^10.0.0 copied to clipboard
Infobip Mobile Messaging Flutter Plugin for Push notifications, LiveChat, and WebRTC calls.
Mobile Messaging SDK plugin for Flutter #
Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application. In almost no time of implementation you get push notification in your application and access to the features of Infobip IP Messaging Platform. The document describes plugin integration steps for your Flutter project.
Requirements #
-
Flutter:
- If using CocoaPods: 3.16.0+
- If using Swift Package Manager (SPM): 3.24.0+
-
For iOS project:
- Xcode 16.x
- Minimum deployment target 15.0
- CocoaPods 1.16.2
-
For Android project:
- Android Studio
- Supported API Levels: 23 (Android 6.0 - Marshmallow) - 37 (Android 17)
Quick start guide #
This guide is designed to get you up and running with Mobile Messaging SDK plugin for Flutter
-
Make sure to setup application at the Infobip portal, if you haven't already.
-
Add MobileMessaging plugin by running:
$ pub get infobip_mobilemessaging
- It will add it to dependencies at
pubspec.yaml:
dependencies:
infobip_mobilemessaging: '^10.0.0'
-
Run
flutter pub getto install plugin -
Configure platforms
-
iOS
The plugin ships both a CocoaPods podspec and a Swift Package Manager manifest, so your app can integrate it with either dependency manager.
Dependency manager setup
CocoaPods
- Update the
ios/Podfilewith iOS deployment target platform 15.0 -platform :ios, '15.0'if needed, and perform in Terminalcd ios && pod install
Swift Package Manager
- Make sure your project uses Flutter 3.24+ with Swift Package Manager support enabled. To enable SPM, run the following command:
flutter config --enable-swift-package-manager- see Flutter's Swift Package Manager docs for more information.
- Run
flutter pub get- Flutter reads the plugin'sPackage.swiftand wires it intoFlutterGeneratedPluginSwiftPackageautomatically. No manual Xcode project changes are required for the main app target. - Set the iOS deployment target to 15.0.
- Import MobileMessaging and add
MobileMessagingPluginApplicationDelegate.install()into<ProjectName>/ios/Runner/AppDelegate.swift(this is required for OS callbacks such asdidRegisterForRemoteNotificationsto be intercepted by native MobileMessaging SDK).
- If using SPM, import the
infobip_mobilemessagingdependency. - If using CocoaPods, import the
MobileMessagingdepdendency. The AppDelegate should now look like the following:
import UIKit import Flutter // if using Swift Package Manager, import the infobip_mobilemessaging dependency import infobip_mobilemessaging // if using CocoaPods, import the MobileMessaging dependency import MobileMessaging @main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { ... MobileMessagingPluginApplicationDelegate.install() ... } } ...Notice #
An Objective-C
AppDelegate.mis only supported with the CocoaPods integration:... @import MobileMessaging; @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... [MobileMessagingPluginApplicationDelegate install]; ... } ...Swift Package Manager integration requires a Swift
AppDelegate.swift.- Configure your project to support Push Notification as described in item 2 of iOS integration quick start guide
- Integrate Notification Service Extension into your app in order to obtain:
- more accurate processing of messages and delivery stats
- support of rich notifications on the lock screen
- Update the
-
Android
- Add 'com.google.gms:google-services' to
android/build.gradlefile
buildscript { ... dependencies { ... //Google Services gradle plugin classpath 'com.google.gms:google-services:4.4.1' } }- Add
apply plugin: 'com.google.gms.google-services'at the end of yourandroid/app/build.gradlein order to apply Google Services Gradle Plugin - Setup Firebase for your project and add a Firebase configuration file (google-services.json) to the app as described in
Firebase documentation. Usually it needs to be added intoandroid/appfolder.
Notice #
If you want to provide the Firebase configuration differently, check Applying Firebase configuration
Notice #
Starting from Android 13, Google requires to ask user for notification permission. Follow this guide to make a permission request.
- Add 'com.google.gms:google-services' to
-
-
Use plugin in your
main.dartfile:import 'package:infobip_mobilemessaging/infobip_mobilemessaging.dart'; import 'package:infobip_mobilemessaging/models/configurations/configuration.dart' as mmconf; import 'package:infobip_mobilemessaging/models/library_event.dart'; ... await InfobipMobilemessaging.init(mmconf.Configuration( applicationCode: '<Your app code>', iosSettings: mmconf.IOSSettings( notificationTypes: ['alert', 'badge', 'sound'], logging: true, ), androidSettings: mmconf.AndroidSettings( multipleNotifications: true, ), )); InfobipMobilemessaging.on(LibraryEvent.messageReceived, (Message event) => { print('Callback. messageReceived event, message text: ${event.body}') }); ...
More details on SDK features and FAQ you can find on Wiki
NEXT STEPS: Users and installations