Push Notification Module

Customization of the Notification Area

RelatedDigital.setIsPushNotificationsEnabled() has 5 mandatory and 8 optional parameters.

Mandatory parameters:

  • context: Context

  • isPushNotificationEnabled: Boolean

  • googleAppAlias: String

  • huaweiAppAlias: String

  • token: String

Optional Parameters:

  • notificationSmallIcon: Int

  • notificationSmallIconDarkMode: Int

  • isNotificationLargeIcon: Boolean

  • notificationLargeIcon: Int

  • notificationLargeIconDarkMode

  • notificationPushIntent: String

  • notificationChannelName: String

  • notificationColor: String

Optional Parameters

Description

Optional Parameters

Description

notificationSmallIcon

For entering the icon that is going to be shown in the status bar and the left top corner of the notification area. You should enter the ID of a resource in your project.

Default Value : Application icon

notificationSmallIconDarkMode

For entering the notificationSmallIcon value when the device is in dark theme mode.

Default Value : Application icon

isNotificationLargeIcon

For determining if there is going to be a large icon in the right of the notification area.

Default Value : false (no large icon)

notificationLargeIcon

For entering the large icon that is going to be shown in the right of the notification area. You should enter the ID of a resource in your project.

Default Value : Application icon (if isNotificationLargeIcon is true)

notificationLargeIconDarkMode

For entering the notificationLargeIcon value when the device is in dark theme mode.

Default Value : Application icon (if isNotificationLargeIcon is true)

notificationPushIntent

For entering the activity that is going to be triggered when the notification is clicked. You should enter the full path of the activity.

Default Value : launcher activity

notificationChannelName

For entering the name of the notification channel.

Default Value : Application name

notificationColor

For entering the accent color value that is going to be used in the notification area.

notificationPriority

For setting the priority of the notification.(For heads-up notifications, the priority must be set to HIGH)

An example use that includes all parameters is below:

Kotlin

RelatedDigital.setIsPushNotificationEnabled( context = context, isPushNotificationEnabled = true, googleAppAlias = "googleAppAliasValue", huaweiAppAlias = "huaweiAppAliasValue", token = token, notificationSmallIcon = R.drawable.text_icon, notificationSmallIconDarkMode = R.drawable.text_icon_dark_mode, isNotificationLargeIcon = true, notificationLargeIcon = R.mipmap.ic_launcher, notificationLargeIconDarkMode = R.mipmap.ic_launcher, notificationPushIntent = "com.relateddigital.androidexampleapp.PushNotificationActivity", notificationChannelName = "relateddigital-android-test", notificationColor = "#d1dbbd" )

Java

RelatedDigital.setIsPushNotificationEnabled( context, true, "googleAppAliasValue", "huaweiAppAliasValue", token, R.drawable.text_icon, R.drawable.text_icon_dark_mode, true, R.mipmap.ic_launcher, R.mipmap.ic_launcher, "com.relateddigital.androidexampleapp.PushNotificationActivity", "relateddigital-android-test", "#d1dbbd" );

 

Getting Push Notification Permission(Android 13 or higher)

Validate your SDK versions. Compile and target SDK version should be at least 33.

android { compileSdkVersion "33" defaultConfig { targetSdkVersion "33" } }

Use the below RelatedDigital method to trigger the native prompt to request push notification permission.

Kotlin

Java

Token-User Match

The information about the user can be sent in signUp/Login stage or after to our servers. If there is a user in the server whose information is the same, the related token will be matched to this user.

After sending the mandatory and optional parameters, you should call sync() method.

Kotlin

Java

When Push Notification Module is enabled via RelatedDigital.setIsPushNotification(), the token information is written to RMC servers. This token is saved as "anonymous". In order to match this token with a user, an identifier information for the user (KEY_ID or EMAIL) should be sent to RMC.

In order the data that you sent to be loaded to RMC panel correctly, you should use the same reference value (KEY_ID* veya E-Mail) that you use in your RMC account when sending data via mobile channel.

*KEY_ID: It is the ID that you use to make a user unique in your system like CRM id, userId, customerId, accountId.

IYS E-Mail Registration (For Turkey)

Kotlin

Java

If your customer is a corporate, you should send isCommercial parameter as true.

If you do not see a user match in RMC, please get in contact with RMC support team and ask to activate the FLAG of the related appKey.

Push Notification Click Report and Directing

When the user clicks on the notification, the activity that you entered via RelatedDigital.setPushIntent() is going to be launched. You should send the click report and direct the user to the related page here in onNewIntent().

Kotlin

Java

You should check the pro-guard issues in your project if you get notification in debug mode but not in release mode.

proguard-rules.pro 'ya aşağıdaki kodları ekleyebilirsiniz;

Custom Notification Sound

You should add the sound files that is going to be used into your project first.

res/raw/my_custom_sound.mp3

After that, go to RMC panel Settings / Campaign Settings / Push Applications / Your Android Application / Custom Sound File

You should enter the name of the sound file without extension to this field.

Campaign Revenue on the Panel

In order to see the revenue as a result of a notification campaign on RMC:

You should enter the utm parameters onto the field of Custom Parameters when creating a push notification campaign.

Example: utm_medium=apppush;utm_source=related;utm_campaign=campaign_name

Push Message History

You can have the anonymous push messages sent in the last 30 days as shown below.

The messages are ordered according to date. The latest message sent is going to be at the beginning of the list.

Kotlin

Java

If you want to save and get the notifications based on user IDs you must set the userID value (email, telephone number, etc) after the user logins in your application via the method below:

Kotlin

Java

After setting the userID like the one above, the notifications will be saved with that user ID. You can get the notifications sent to the user who is logged-in in your application by using the getPushMessagesWithID() method:

Kotlin

Java

 

Push Message Content

Veri Tipi

DeÄŸiÅŸken

Açıklama

Veri Tipi

DeÄŸiÅŸken

Açıklama

String

mediaUrl

Photo, video url

String

altUrl

Alternate URL

String

campaignId

Campaign ID

String

pushId

Notification ID

String

url

Campaign URL

String

message

Notification Message

String

title

Notification Title

String

sound

Notification Sound

PushType

pushType

Notification Type

Map<String, String>

params

Custom Parameters

Application Badge Count

The number of the notifications that come from Related Digital is shown on the application icon if the user chooses showing it as number. In order to clear this number when the application is opened, you should call clearBadgeCount() method as below:

 

Extra Notes

EXTERNAL_STORAGE Permissions

You should add the line below into AndroidManifest.xml file under <application tag if you use WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permissions in your application.

PUSH_SUBSCRIPTION_PERMISSION_ENABLED

If you want to transfer the logged-in users in your push application to Euromessage user panel directly, you can ask RMS Support Team to enable PUSH_SUBSCRIPTION_PERMISSION_ENABLED flag.

Example Application

RelatedDigital Example Application

Copyright 2020 Related Digital