SDKs
iOS - Push Notifications
Overview
DataSenses allows you to send push notifications to your applications from our dashboard. Please follow the steps to send your first push notification to your application. Please note to test remote push notifications you need to connect your actual iOS device. The remote push notifications don't work on simulator.
Configure Push Notifications with DataSenses
Installation
Register the notification token and send to DataSenses. Below is an example how to implement your owned notification system and share the token to DataSenses.
Add the configuration to Manifest.xml
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<service
android:name=".MyFirebaseMessageService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
class MyFirebaseMessageService: FirebaseMessagingService() {
override fun onNewToken(token: String) {
super.onNewToken(token)
// Send the token to your server or save it locally
Log.d("FCM", "New token: $token")
DataSenses.registerPushNotification(token)
}
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
// Check if the message contains a notification payload.
remoteMessage.notification?.let {
//Your code
}
}
}
If your team is using Firebase as your messaging system. Please read the following
Register the notification token and send to DataSenses. An example as below
DataSenses.registerPushNotification(token)