Versions Compared

Key

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

SDK'nın init edilmesi

Info

init() metodunun Application sınıfının içerisinde çağırılması önerilir. Application sınıfını AndroidManifest.xml dosyasında <application tag ı içerisinde android:name ile tanımlamayı unutmayınız.

...

Bu bilgilere RMC paneli üzerinden ulaşabilirsiniz.

...

Kullanılacak Modüllerin Aktifleştirilmesi

RelatedDigital SDK 3 ayrı modülden oluşmaktadır :

...

Code Block
languagekotlin
class MainApplication : Application() {
    override fun onCreate() {
        super.onCreate()

        // RelatedDigital SDK nın init edilmesi
        RelatedDigital.init(
                context = applicationContext,
                organizationId = "organizationIdDeğeri",
                profileId = "profileIdDeğeri",
                dataSource = "dataSourceDeğeri")

        // In-App Notification Modülünün etkinleştirilmesi
        RelatedDigital.setIsInAppNotificationEnabled(
            context = applicationContext,
            isInAppNotificationEnabled = true
        )

        // Push Notification Modülünün Etkinleştirilmesi
        if(GoogleUtils.checkPlayService(this)) {
            getFirebaseToken()
        } else {
            getHuaweiToken()
        }

        // Geofence Modülünün Etkinleştirilmesi
        RelatedDigital.setIsGeofenceEnabled(
            context = applicationContext,
            isGeofenceEnabled = true
        )
    }

    private fun getFirebaseToken(){
        FirebaseMessaging.getInstance().token
            .addOnCompleteListener(OnCompleteListener { task ->
                if (!task.isSuccessful) {
                    Log.e("Firebase Token : ", "Getting the token failed!!!")
                    return@OnCompleteListener
                }
                val token = task.result

                // Push Notification Modülünün Etkinleştirilmesi
                RelatedDigital.setIsPushNotificationEnabled(
                    context = applicationContext,
                    isPushNotificationEnabled = true,
                    googleAppAlias = "googleAppAliasDeğeri",
                    huaweiAppAlias = "huaweiAppAliasDeğeri",
                    token = token
                )
            })
    }

    private fun getHuaweiToken() {
        object : Thread() {
            override fun run() {
                try {
                    val appId = AGConnectOptionsBuilder().build(applicationContext)
                        .getString("client/app_id")
                    val token = HmsInstanceId.getInstance(applicationContext).getToken(appId, "HCM")
                    if (TextUtils.isEmpty(token) || token == null) {
                        Log.e("Huawei Token : ", "Empty token!!!")
                        return
                    }
                    Log.i("Huawei Token", "" + token)

                    // Push Notification Modülünün Etkinleştirilmesi
                    RelatedDigital.setIsPushNotificationEnabled(
                        context = applicationContext,
                        isPushNotificationEnabled = true,
                        googleAppAlias = "googleAppAliasDeğeri",
                        huaweiAppAlias = "huaweiAppAliasDeğeri",
                        token = token
                    )
                } catch (e: ApiException) {
                    Log.e("Huawei Token", "Getting the token failed! $e")
                }
            }
        }.start()
    }
}

Push Notification Modülü (Euromessage)

Bildirim Alanın Özelleştirilmesi

Bu modül mobil bildirim kampanyalarınız içindir. Yukarda belirtildiği gibi etkinleştirilmesi gerekmektedir.

...