Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Customization of the Notification Area

...

  • notificationSmallIcon: Int

  • notificationSmallIconDarkMode: Int

  • isNotificationLargeIcon: Boolean

  • notificationLargeIcon: Int

  • notificationLargeIconDarkMode

  • notificationPushIntent: String

  • notificationChannelName: String

  • notificationColor: String

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:

...

Code Block
languagejava
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"
);

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

...

languagekotlin

...

...

Getting Push Notification Permission(Android 13 or higher)

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

Code Block
languagegroovy
android {
    compileSdkVersion "33"

    defaultConfig {
        targetSdkVersion "33"
    }
}

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

Kotlin

Code Block
languagekotlin
RelatedDigital.requestNotificationPermission(activity)

Java

Code Block
language

...

kotlin
RelatedDigital.

...

requestNotificationPermission(activity);

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

Code Block
languagekotlin
--Mandatory parameters--
RelatedDigital.setEmail(context, "test@euromsg.com")
RelatedDigital.setRelatedDigitalUserId(context, "testRelatedDigitalUserId")

--Optional parameters--
RelatedDigital.setEmailPermit(context, EmailPermit.ACTIVE)
RelatedDigital.setGsmPermit(context, GsmPermit.ACTIVE)
RelatedDigital.setTwitterId(context, "testTwitterId")
RelatedDigital.setFacebookId(context, "testFacebookId")

...


RelatedDigital.setPhoneNumber(context, "testPhoneNumber")

...


RelatedDigital.setUserProperty(context, "instagram", "testInstagramId")

...



RelatedDigital.sync(context)

...

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.

...

Code Block
languagejson
"extra" : {
  "email" : "test@euromsg.com",
  "keyID" : "testRelatedDigitalUserId"
}

IYS E-Mail Registration (For Turkey)

Kotlin

...

languagekotlin

...

Java

Code Block
languagejava
--Mandatory parameters--
RelatedDigital.setEmail(context, "test@euromsg.com");
RelatedDigital.setRelatedDigitalUserId(context, "testRelatedDigitalUserId");

--Optional parameters--
RelatedDigital.setEmailPermit(context, EmailPermit.ACTIVE);
RelatedDigital.setGsmPermit(context, GsmPermit.ACTIVE);
RelatedDigital.setTwitterId(context, "testTwitterId");
RelatedDigital.setFacebookId(context, "testFacebookId");
RelatedDigital.setPhoneNumber(context, "testPhoneNumber");
RelatedDigital.setUserProperty(context, "instagram", "testInstagramId");

RelatedDigital.sync(context);

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.

Code Block
languagejson
"extra" : {
  "email" : "test@euromsg.com",
  

...

"keyID" 

...

Java

...

languagejava

...

: "testRelatedDigitalUserId"
}

IYS E-Mail Registration (For Turkey)

Kotlin

Code Block
languagekotlin
val callback: EuromessageCallback = object : EuromessageCallback {
  override fun success() {
    Log.i("IYS Kaydı", "Successful");
  }

  @Override
  public voidoverride fun fail(errorMessage: String errorMessage?) {
    Log.e("IYS Kaydı", "Fail : $errorMessage" + errorMessage);
  }
};

RelatedDigital.registerEmail(
  context = context,
  "email = "test@euromsg.com",
  emailPermit = EmailPermit.ACTIVE,
  isCommercial = false,
  callback = callback
);

Java

Info

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

Info

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

override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) if (intent != null) { val bundle = intent.extras if (bundle != null) { val message = intent.extras!!.getSerializable("message") as Message?
Code Block
languagekotlin
Code Block
languagejava
EuromessageCallback callback = new EuromessageCallback() {
  @Override
  public void success() {
    Log.i("IYS Kaydı", "Successful");
  }

  @Override
  public void fail(String errorMessage) {
    Log.e("IYS Kaydı", "Fail : " + errorMessage);
  }
};

RelatedDigital.registerEmail(
  context,
  "test@euromsg.com",
  EmailPermit.ACTIVE,
  false,
  callback
);
Info

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

Info

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

Code Block
languagekotlin
override fun onNewIntent(intent: Intent?) {
    super.onNewIntent(intent)
    if (messageintent != null) {
        val bundle = intent.extras
    //Send the click report
  if (bundle != null) {
            val message = RelatedDigital.sendPushNotificationOpenReport(this, message)
 intent.extras!!.getSerializable("message") as Message?
            if  //Direct the user to the related page - message.url(message != null) {
                //Send the click report
  ..             } else { RelatedDigital.sendPushNotificationOpenReport(this, message)
                //Direct Itthe showsuser thatto athe carouselrelated notificationpage is- camemessage.url
and the user clicked on an item          ..
      val itemClickedUrl = bundle.getString("CarouselItemClickedUrl")   } else {
           if (itemClickedUrl != null && itemClickedUrl// != "") {
          It shows that a carousel notification is came and the user clicked on an item
         //Direct the user to the related page -val itemClickedUrl = bundle.getString("CarouselItemClickedUrl")
                if (itemClickedUrl ..!= null && itemClickedUrl != "") {
          }          //Direct the user to }the related page - itemClickedUrl
    }     } }

Java

Code Block
languagejava
@Override protected void onNewIntent(Intent intent) {     super..onNewIntent(intent);
    if(intent != null) {         Bundle}
bundle = intent.getExtras();         if (bundle}
!= null) {      }
    }
 Message message = (Message) intent.getExtras().getSerializable("message");
}

Java

Code Block
languagejava
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
      if(messageintent != null) {
        Bundle bundle = intent.getExtras();
    //Send the click report    if (bundle != null) {
            Message message =  RelatedDigital.sendPushNotificationOpenReport(this, message(Message) intent.getExtras().getSerializable("message");
            if(message != null) {
//Direct the user to the related page - message.url        //Send the click report
     ..           RelatedDigital.sendPushNotificationOpenReport(this, message);
} else {              //Direct the user //to Itthe showsrelated thatpage a- carouselmessage.url
notification is came and the user clicked on an item       ..
         String itemClickedUrl = bundle.getString("CarouselItemClickedUrl");
  } else {
              if(itemClickedUrl != null && !itemClickedUrl.equals("")) {
            // It shows that a carousel notification is came and the user clicked on an item
         //Direct the user to the related page -String itemClickedUrl = bundle.getString("CarouselItemClickedUrl");
                if(itemClickedUrl != ..
        null && !itemClickedUrl.equals("")) {
                    //Direct the user to the related page - itemClickedUrl
       }             ..
  }         }     }
}
Info
            }
        }
    }
}
Info

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

...

Info

You can use the campaign ID as utm_campaign since it has to be different each time. For this, you can use <##CAMP_ID##> variable.

  1. Image Modified

Push Message History

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

...

Code Block
languagejava
PushMessageInterface pushMessageInterface = new PushMessageInterface() {
  @Override
  public void success(List<Message> pushMessages) {
    // You can write your code here by using pushMessages
  }

  @Override
  public void fail(String errorMessage) {
    Log.e("Past Notifications", errorMessage)
  }
};

RelatedDigital.getPushMessages(activity, pushMessageInterface);

Push Message Content

...

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

...

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

Code Block
languagekotlin
RelatedDigital.setNotificationLoginID("user_id", context)

Java

Code Block
languagejava
RelatedDigital.setNotificationLoginID("user_id", context);

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

Code Block
languagekotlin
val pushMessageInterface: PushMessageInterface = object : PushMessageInterface {
  override fun success(pushMessages: List<Message>) {
    // Make your implementation by using pushMessages here:
  }

  override fun fail(errorMessage: String) {
    Log.e("Past Notifications", errorMessage)
  }
}

RelatedDigital.getPushMessagesWithID(activity, pushMessageInterface)

Java

Code Block
languagejava
PushMessageInterface pushMessageInterface = new PushMessageInterface() {
  @Override
  public void success(List<Message> pushMessages) {
    // Make your implementation by using pushMessages here:
  }

  @Override
  public void fail(String errorMessage) {
    Log.e("Past Notifications", errorMessage)
  }
};

RelatedDigital.getPushMessagesWithID(activity, pushMessageInterface);

Push Message Content

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:

Code Block
RelatedDigital.clearBadgeCount(context);
Code Block
RelatedDigital.clearBadgeCount(context)

 

Info

It is recommended to call the method above in onCreate() method of MainApplication and MainActivity classes so that when the application is opened the number gets cleared. Besides, it should be called in onNewIntent() method of the activity that the user will be directed to when he/she clicks on the notification.

Extra Notes

EXTERNAL_STORAGE Permissions

...