All Projects → infobip → mobile-messaging-sdk-ios

infobip / mobile-messaging-sdk-ios

Licence: Apache-2.0 license
Mobile Messaging SDK for iOS

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to mobile-messaging-sdk-ios

Socket.io Push
整合了小米,华为,友盟,谷歌,苹果推送的统一解决方案
Stars: ✭ 605 (+1244.44%)
Mutual labels:  notifications, push-notifications, apns, push
Notificationpusher
Standalone PHP library for easy devices notifications push.
Stars: ✭ 1,143 (+2440%)
Mutual labels:  notifications, push-notifications, apns, push
Onesignal Unity Sdk
OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com
Stars: ✭ 161 (+257.78%)
Mutual labels:  notifications, push-notifications, apns
MongoosePush
MongoosePush is a simple Elixir RESTful service allowing to send push notification via FCM and/or APNS.
Stars: ✭ 101 (+124.44%)
Mutual labels:  notifications, apns, push
Onesignal Ios Sdk
OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Stars: ✭ 370 (+722.22%)
Mutual labels:  notifications, push-notifications, apns
Swift Apns
Swift Framework for sending Apple Push Notification over HTTP/2 API
Stars: ✭ 147 (+226.67%)
Mutual labels:  push-notifications, apns, push
spontit-api-python-wrapper
Send functional, flexible push notifications to iOS, Android, and desktop devices (without your own app or website).
Stars: ✭ 35 (-22.22%)
Mutual labels:  notifications, push-notifications, push
andpush
Android Push Notification in Ruby: The fastest client for FCM (Firebase Cloud Messaging)
Stars: ✭ 83 (+84.44%)
Mutual labels:  notifications, push-notifications, push
Push.js
The world's most versatile desktop notifications framework 🌎
Stars: ✭ 8,536 (+18868.89%)
Mutual labels:  notifications, push-notifications, push
React Native Onesignal
React Native Library for OneSignal Push Notifications Service
Stars: ✭ 1,270 (+2722.22%)
Mutual labels:  notifications, push-notifications, push
ejabberd mod apns
An ejabberd module to send PUSH messages to iOS devices through APNS
Stars: ✭ 31 (-31.11%)
Mutual labels:  push-notifications, apns, push
Onepush
消息推送用OnePush,就够了!
Stars: ✭ 1,401 (+3013.33%)
Mutual labels:  notifications, push-notifications, push
PushMeBaby
iOS Push Notification Debug App. You can use this app during iOS Push Notification (development or production) to push notifications on your device from your Mac.
Stars: ✭ 47 (+4.44%)
Mutual labels:  notifications, apns, push
Easynotifylibproject
Send firebase notifications to your users very easily: A new Android Lib
Stars: ✭ 31 (-31.11%)
Mutual labels:  notifications, push-notifications, push
Pushy
A Java library for sending APNs (iOS/macOS/Safari) push notifications
Stars: ✭ 1,353 (+2906.67%)
Mutual labels:  notifications, push-notifications, apns
Net Core Push Notifications
Lightweight .NET Core Push Notifications for Android and iOS
Stars: ✭ 105 (+133.33%)
Mutual labels:  notifications, push-notifications, apns
Ng2 Notifications
Angular 2 Component for Native Push Notifications [Looking for New Maintainers]
Stars: ✭ 192 (+326.67%)
Mutual labels:  notifications, push-notifications
Web Push Php Example
An example for sending Web Push notifications, using web-push-php
Stars: ✭ 173 (+284.44%)
Mutual labels:  notifications, push-notifications
Apns Http2
A Java library for sending notifications via APNS using Apple's HTTP/2 API.
Stars: ✭ 194 (+331.11%)
Mutual labels:  notifications, apns
Apns2
⚡ HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, Safari and OSX apps, using the APNs HTTP/2 protocol.
Stars: ✭ 2,569 (+5608.89%)
Mutual labels:  notifications, apns

Mobile Messaging SDK for iOS

Version License Platform

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 Mobile Apps Messaging. The document describes library integration steps. Additional information can be found in our Wiki.

Requirements

  • Xcode 13.2.1+
  • Swift 4.2, Swift 5
  • iOS 12.0+

Quick start guide

This guide is designed to get you up and running with Mobile Messaging SDK integrated into your iOS application.

  1. Make sure to setup application at Infobip portal, if you haven't already.

  2. Configure your project to support Push Notifications:

    1. Click on "Capabilities", then turn on Push Notifications. Entitlements file should be automatically created by Xcode with set aps-environment value.
    Enable Push Notifications capability
    1. Turn on Background Modes and check the Remote notifications checkbox.
    Enable Remote Notifications in Background Modes settings
  3. Using CocoaPods, specify it in your Podfile:

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '12.0'
    use_frameworks!
    pod 'MobileMessaging'

    Notice

    CocoaLumberjack logging used by default, in order to use other logging or switch it off follow this guide.

    If you use Carthage, see Integration via Carthage guide.

  4. Import the library into your AppDelegate file:

    // Swift
    import MobileMessaging
    expand to see Objective-C code

    @import MobileMessaging;

  5. Start MobileMessaging service using your Infobip Application Code, obtained in step 1, and preferable notification type as parameters:

    // Swift
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        MobileMessaging.withApplicationCode(<#your application code#>, notificationType: <#for example MMUserNotificationType(options: [.alert, .sound])#>)?.start()
        ...
    }   
    expand to see Objective-C code

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        MMUserNotificationType *userNotificationType = [[MMUserNotificationType alloc] initWithOptions:<#for example @[MMUserNotificationType.alert, MMUserNotificationType.sound]#>;
        [[MobileMessaging withApplicationCode: <#your application code#> notificationType: userNotificationType] start:nil];
        ...
    }

    In case you already use other Push Notifications vendor's SDK, add withoutRegisteringForRemoteNotifications() to the start call:

    // Swift
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        MobileMessaging.withApplicationCode(<#your application code#>, notificationType: <#for example MMUserNotificationType(options: [.alert, .sound])#>)?.withoutRegisteringForRemoteNotifications()?.start()
        ...
    }   

    Please note that it is not very secure to keep your API key (Application Code is an API key in fact) hardcoded so if the security is a crucial aspect, consider obfuscating the Application Code string (we can recommend UAObfuscatedString for string obfuscation).

  6. Add one line of code MobileMessaging.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken) to your AppDelegate method application:didRegisterForRemoteNotificationsWithDeviceToken: in order to inform Infobip about the new device registered:

    // Swift
    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        MobileMessaging.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken)
        
        // other push vendors might have their code here and handle a Device Token as well
    }
    expand to see Objective-C code

    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        [MobileMessaging didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
    
        // other push vendors might have their code here and handle a Device Token as well
    }

  7. Add one line of code MobileMessaging.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler) to your AppDelegate method application:didReceiveRemoteNotification:fetchCompletionHandler: in order to send notification's delivery reports to Infobip:

    // Swift
    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        MobileMessaging.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler)
    
        // other push vendors might have their code here and handle a remove notification as well
    }
    expand to see Objective-C code

    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
        [MobileMessaging didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
    
        // other push vendors might have their code here and handle a remove notification as well
    }

  8. 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

In case of a clean project, your AppDelegate.swift code should look like following:

AppDelegate source code example

If all the steps implemented correctly, run your application on a real device, you should see the logs in Xcode console confirming that the MobileMessaging SDK has been initialized succesfully and the device has been registered on APNS to receive Push messages:

2019-01-28 18:24:16:003 [MobileMessaging] ℹ️ SDK successfully initialized!
...
2019-01-28 18:25:44:144 [MobileMessaging] ℹ️ [APNS reg manager] Application did register with device token <...>

If you don't see any logs, set up the default logger before starting the SDK: MobileMessaging.logger = MMDefaultLogger(). Please note that the logs are only collected while your project is in "debug" configuration.

Please pay close attention to a Provisioning Profile that is used for your project build. It must match the APNs environment! If they don't, we'll invalidate the device push registration (more information here I don't receive push notifications!

Notice

Push notifications (if they are not in-app) are not displayed automatically when the app is on the foreground. For further information check FAQ - How to display messages when app is running in the foreground?.


NEXT STEPS: User profile



If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].