Table of Contents |
---|
Bildirim Alanın Özelleştirilmesi
RelatedDigital.setIsPushNotificationsEnabled() metodu 5 zorunlu, 8 opsiyonel parametre almaktadır.
...
Table of Contents |
---|
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
Opsiyonel ParametrelerOptional Parameters:
notificationSmallIcon: Int
notificationSmallIconDarkMode: Int
isNotificationLargeIcon: Boolean
notificationLargeIcon: Int
notificationLargeIconDarkMode
notificationPushIntent: String
notificationChannelName: String
notificationColor: String
Opsiyonel ParametrelerOptional Parameters | AçıklamaDescription |
---|---|
| Status Bar’da ve bildirim alanının sol üstünde görüntülenecek ikonu girmek içindir. Projenizdeki herhangi bir resource un id sini vermeniz gerekmektedir. Eğer değer girilmezse uygulamanızın simgesi kullanılır. |
| Cihaz koyu temadayken görünecek Eğer değer girilmezse uygulamanızın simgesi kullanılır. |
| Bildirim alanının sağında bir ikon bulunup bulunmamasına karar vermek içindir. true → bulunur false → bulunmaz Eğer değer girilmezse büyük ikon kullanılmaz.(false) |
| Bildirim alanının sağında görünecek büyük ikonu girmek içindir. Projenizdeki herhangi bir resource un id sini vermeniz gerekmektedir. Eğer değer girilmezse ve |
| Cihaz koyu temadayken görünecek Eğer değer girilmezse ve |
| Bildirime tıklandığında açılacak Activity'e karar vermek içindir. Burda Activity'nin tam yolunun girilmesi gerekmektedir. Eğer değer girilmezse uygulamanızın başlatıcı aktivitesine (launcher activity) yönlenecektir. |
| Bildirim kanalına verilecek ismi girmek içindir. Eğer değer girilmezse uygulamanızın ismi kullanılır. |
| Bildirim alanında kullanılacak accent color değerini girmek içindir. |
Tüm parametreleri içeren örnek bir kullanım aşağıdaki gibidir.
Kotlin
...
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 | |
| For entering the Default Value : Application icon |
| For determining if there is going to be a large icon in the right of the notification area. Default Value : false (no large icon) |
| 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 |
| For entering the Default Value : Application icon (if |
| 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 |
| For entering the name of the notification channel. Default Value : Application name |
| For entering the accent color value that is going to be used in the notification area. |
An example use that includes all parameters is below:
Kotlin
Code Block | ||
---|---|---|
| ||
RelatedDigital.setIsPushNotificationEnabled( context = context, isPushNotificationEnabled = true, googleAppAlias = "googleAppAliasDeğerigoogleAppAliasValue", huaweiAppAlias = "huaweiAppAliasDeğerihuaweiAppAliasValue", 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
Code Block | ||
---|---|---|
| ||
RelatedDigital.setIsPushNotificationEnabled( context, true, "googleAppAliasDeğerigoogleAppAliasValue", "huaweiAppAliasDeğerihuaweiAppAliasValue", 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-
...
Kullanıcıya ait çeşitli parametreler biliniyorsa kayıt aşamasında ya da sonrasında aşağıdaki gibi sunucularımıza gönderilebilir. Aşağıdaki kod bloğu sayesinde aynı bilgilere ait kullanıcı RMC panelinde varsa, alınan token kullanıcı ile eşleştirilecektir.
...
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
Code Block | ||
---|---|---|
| ||
--ZorunluMandatory parametrelerparameters-- RelatedDigital.setEmail(context, "test@euromsg.com"); RelatedDigital.setRelatedDigitalUserId(context, "testRelatedDigitalUserId"); --OpsiyonelOptional parametrelerparameters-- RelatedDigital.setEmailPermit(context, EmailPermit.ACTIVE); RelatedDigital.setGsmPermit(context, GsmPermit.ACTIVE.ACTIVE); RelatedDigital.setTwitterId(context, "testTwitterId"); RelatedDigital.setFacebookId(context, "testFacebookId"); RelatedDigital.setTwitterIdsetPhoneNumber(context, "testTwitterIdtestPhoneNumber"); RelatedDigital.setFacebookIdsetUserProperty(context, "testFacebookId"instagram", "testInstagramId"); RelatedDigital.setPhoneNumber(context, "testPhoneNumber"); RelatedDigital.setUserProperty(context, "instagram", "testInstagramId"); RelatedDigital.sync(context);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.
RelatedDigital.setIsPushNotification() metodu aracılığıyla Push Notification Modülü etkinleştirildiğinde, cihaza ait token bilgisi RMC veri tabanına yazılır. Bir token; kullanıcı uygulamada oturum açana kadar “anonim” yani hiç bir kullanıcı ile eşleştirilmeden kaydedilir. Bu token ın bir kullanıcıyla eşleştirilebilmesi için uygulamada oturum açılmış olması ve SDK tarafından bu token ın sahibini tanımlayıcı bir bilginin (KEY_ID yada EMAIL) RMC'ye gönderilmesi gerekir. Bu bilgiler push mesajı payload unda "extra" : {} bloğunda yer alır.
Mobil kanaldan gelen datalarınızın RMC'ye yüklenebilmesi için, aktif RMC hesabınızda kullanmış olduğunuz referans değeriniz ne ise 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) mobil kanaldan gelen dataların da bu referans ile gelmesine dikkat ediniz."that you use in your RMC account when sending data via mobile channel.
*KEY_ID: Uygulama sahibi tarafından müşterisinin tekilleştirilmesi için kullanılan id değerleridir. Bunlar It is the ID that you use to make a user unique in your system like CRM id, userId, customerId, accountId gibi farklı isimlerle ifade ediliyor olabilir.
Kullanıcı-token eşleşmesi için gönderilen payload da extra parametresi bu şekilde parametreler alacaktır;
...
.
|
IYS E-
...
Mail Registration (For Turkey)
Kotlin
Code Block | ||
---|---|---|
| ||
val callback: EuromessageCallback = object : EuromessageCallback { override fun success() { Log.i("IYS Kaydı", "BaşarılıSuccessful") } override fun fail(errorMessage: String?) { Log.e("IYS Kaydı", "BaşarısızFail : $errorMessage") } } RelatedDigital.registerEmail( context = context, email = "test@euromsg.com", emailPermit = EmailPermit.ACTIVE, isCommercial = false, callback = callback ) |
Java
Code Block | ||
---|---|---|
| ||
EuromessageCallback callback = new EuromessageCallback() { @Override public void success() { Log.i("IYS Kaydı", "BaşarılıSuccessful"); } @Override public void fail(String errorMessage) { Log.e("IYS Kaydı", "BaşarısızFail : " + errorMessage); } }; RelatedDigital.registerEmail( context, "test@euromsg.com", EmailPermit.ACTIVE, false, callback ); |
Info |
---|
Eğer kullanıcınız kurumsal bir hesap ise registerEmail() metodundaki isCommercial parametresini true olarak göndermeniz gerekmektedirIf your customer is a corporate, you should send isCommercial parameter as true. |
Info |
---|
Okundu Raporu ve Yönlendirme
Kullanıcı bildirime tıkladığında RelatedDigital.setPushIntent() metodu aracılığıyla girdiğiniz Activity açılacaktır. Eğer bu metodu kullanmadıysanız launcher activity açılacaktır. Bu Activity de onNewIntent() metodu içerisinde bildirim içeriği elde edilip kullanıcıyı ilgili sayfaya yönlendirme ve bildirimle ilgili okundu raporu gönderilme işlemlerinin yapılması gerekmektedir.
Kotlin
Code Block |
---|
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 | ||
---|---|---|
| ||
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? if (message != null) { //OkunduSend the raporununclick gönderilmesireport RelatedDigital.sendPushNotificationOpenReport(this, message) //Kullanıcının ilgili sayfaya yönlendirilmesiDirect the user to the related page - message.url .. } else { // Carousel bildiriminin geldiğini ve kullanıcının bir öğeye tıkladığını gösterir It shows that a carousel notification is came and the user clicked on an item val itemClickedUrl = bundle.getString("CarouselItemClickedUrl") if (itemClickedUrl != null && itemClickedUrl != "") { //Kullanıcının ilgili sayfaya yönlendirilmesiDirect the user to the related page - itemClickedUrl .. } } } } } |
Java
Code Block | ||
---|---|---|
| ||
@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"); if(message != null) { //OkunduSend the raporununclick gönderilmesireport RelatedDigital.sendPushNotificationOpenReport(this, message); //Kullanıcının ilgili sayfaya yönlendirilmesiDirect the user to the related page - message.getUrl()url .. } else { // Carousel bildiriminin geldiğini ve kullanıcının bir öğeye tıkladığını gösterir It shows that a carousel notification is came and the user clicked on an item String itemClickedUrl = bundle.getString("CarouselItemClickedUrl"); if(itemClickedUrl != null && !itemClickedUrl.equals("")) { //Direct //Kullanıcının ilgili sayfaya yönlendirilmesithe user to the related page - itemClickedUrl .. } } } } } |
Info |
---|
Eğer RMC’den kampanya gönderimlerinizde push bildirimi cihazınıza debug modda ulaşıyor, release modda ulaşmıyorsa, uygulamanızda pro-guard ile ilgili sorunlarınıza göz atınYou 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;
...
Mesajlar tarihe göre sıralanmıştır. Son gelen mesaj listenin ilk başında gösterilir.
Kotlin
Code Block | ||
---|---|---|
| ||
val pushMessageInterface: PushMessageInterface = object : PushMessageInterface { override fun success(pushMessages: List<Message>) { // pushMessages değişkenini kullanarak geliştirmenizi yapabilirsiniz } override fun fail(errorMessage: String) { Log.e("Geçmiş Bildirimler", errorMessage) } } RelatedDigital.getPushMessages(activity, pushMessageInterface) |
Java
Code Block | ||
---|---|---|
| ||
PushMessageInterface pushMessageInterface = new PushMessageInterface() { @Override public void success(List<Message> pushMessages) { // pushMessages değişkenini kullanarak geliştirmenizi yapabilirsiniz } @Override public void fail(String errorMessage) { Log.e("Geçmiş Bildirimler", errorMessage) } }; RelatedDigital.getPushMessages(activity, pushMessageInterface); |
Bildirim Mesajı İçeriği
Veri Tipi | Değişken | Açıklama |
---|---|---|
String | mediaUrl | Foto, video url |
String | altUrl | Alternate URL |
String | campaignId | Kampanya ID si |
String | pushId | Bildirim ID si |
String | url | Kampanya URL si |
String | message | Bildirim Mesajı |
String | title | Bildirim Başlığı |
String | sound | Bildirim Sesi |
PushType | pushType | Bildirim Tipi |
Map<String, String> | params | Özel Parametreler |
...