HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center
Documentation

Managing Notifications for iOS

Detailed in this page is how you can set up push notifications as well as manage in-app notifications for new in-app chat messages for your iOS apps.

Push Notifications

You can enable Luciq to send your users push notifications each time you send them a new message.

Uploading Your Push Certificate

Follow the steps below to upload your push certificate to your Luciq dashboard.

  1. Follow this tutorial to generate a push certificate and export it to a .pem file.
  2. Go to the Push Notifications page on your Luciq dashboard and upload your .pem file.
  3. Select whether the certificate you're uploading is for development or production, and enter the pass phrase if you set one.

Handling Luciq Notifications

In application:didRegisterForRemoteNotificationsWithDeviceToken:, pass the token you get to Luciq.

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Replies.didRegisterForRemoteNotifications(withDeviceToken: deviceToken)
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [LCQReplies didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

When you receive a notification, check if it's an Luciq notification, then pass it to Luciq if necessary.

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
    let isLuciqNotification = Replies.didReceiveRemoteNotification(userInfo)
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    BOOL isLuciqNotification = [LCQReplies didReceiveRemoteNotification:userInfo];
}

And finally, handle when your application has been launched from an Luciq notification. Add the following to application:didFinishLaunchingWithOptions:.

if let notification = launchOptions?[.remoteNotification] as? [String: AnyObject] {
   let isLuciqNotification = Replies.didReceiveRemoteNotification(notification)
 }
NSDictionary *notificationDictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

BOOL isLuciqNotification = [LCQReplies didReceiveRemoteNotification:notificationDictionary];

Disabling Push Notifications

Push notifications are enabled by default if you upload a push certificate to your Luciq dashboard. To disable them, use the following method.

Replies.pushNotificationsEnabled = false
[LCQReplies setPushNotificationsEnabled:NO];

In-App Notifications

By default, a notification will be shown on top of your app's UI when a new message is received.

1038

An example of an in-app notification.

📘

Email Notifications

If your user doesn't view the new message within 10 minutes, they will be sent an email notification as well.

Disabling In-App Notifications

Use the following method to disable notifications that appear in-app.

Replies.inAppNotificationsEnabled = false
LCQReplies.inAppNotificationsEnabled = NO;

Getting Unread Messages Count

You can use the following method to get the number of messages a user has yet to read.

let messageCount = Replies.unreadRepliesCount
NSUInteger messageCount = LCQReplies.unreadRepliesCount;

What’s Next

Learn to identify your users so that push notifications always go to the correct user. Also check out how to communicate with your users by chatting with them through different pages in your dashboard.