Push Notification
Push notification is a very important aspect in a chat application. Taptalk.io provides a convenient way to implement push notifications so you can easily manage them according to your needs. If you implement Taptalk.io with the UI implementation method, incoming notifications will be handled within our library and will be automatically shown to the user. If you prefer having full control over the push notifications, the core implementation method can be used.
Push notification for iOS client apps are sent using Apple Push Notification service (APNs). They are used for keeping your users informed with timely and relevant content, whether your client app is running in the background or inactive on a device. They can also perform the types of user interactions such as alert, sound, or badge, and include custom data your app needs to respond to the notifications.
Our iOS SDK enables you to build a client app that can receive push notifications. When a message is sent to TapTalk.io server through the SDK, the server communicates with APNs regarding the message and then APNs delivers a push notification for the message to an iOS device where your client app is installed.
Step 1: Generating your .p8 key file
Configuration with auth keys is recommended as they are the more current method for sending notifications to iOS.
A .p8 key file is required to send push notifications to your apps. There are some several ways to generate key for push notification, but Apple recommends to use APNs Auth Key (.p8 key file) to register for push notifications.
1. To generate a .p8 key file, go to Apple developer account page , then select Certificates, IDs & Profiles.
2. Next, select Keys tab.
3. Click "+" button or click Create a key button to add new key.
4. In the new key page, type in your key name and check the Apple Push Notification service (APNs) box, then click Continue.
5. Confirm your key information and click Register.
Then proceed to download the key file by clicking Download.
Please remember the Key ID provided in the information above or you can see the Key ID from the downloaded file. The Auth Key filename will look like this : AuthKey_ABC12DE34.p8, the ABC12DE34 is the Key ID for this key, we will need this Key ID later.
Step 2: Using .p8 key file in TapTalk.io dashboard to send push notification
1. Go to TapTalk.io Dashboard page, and login to your dashboard.Select Tab Development -> Push Certificates 2. Select Tab Development -> Push Certificates
3. Next, select Add APNs Authentication Key
4. Upload .p8 Authentication Key, add APN Key ID, add Team ID, and select to show unread count option
You can find your Team ID in the Apple Member Center under the membership tab.
Show Unread Count
You can choose either to show unread count by chat room or not show unread count
Step 3: Implement push notification in your app
1. The first step is to implement UIApplicationDelegate
& TapTalkApplicationDelegate
in your AppDelegate class.
2. Request authorization to Apple Push Notification Service (APNs) by using this method in your appDelegate class with application:didFinishLaunchingWithOptions:
method.
3. Implement UNUserNotificationCenterDelegate
to handle notification in your appDelegate class.
4. Implement TapTalkDelegate
in appDelegate class.
Add In-App Notification
TapTalk.io provides in-app notification handling. This following code enables you to activate and show in-app notification.
Note: You will not receive any in-app notification if you don't implement this method.
Last updated