kotlinflurry

Flurry push - issue with Kotlin


I am not finding an easy way to integrate Flurry push with Kotlin.

I added the first parts of the auto installation. and I get red lines under key parts of the script.

Mainly .withFlurryMessagingListener(flurryMessagingListener) seems it can't find flurryMessagingListener

 val flurryMessagingOptions = FlurryMarketingOptions.Builder()
            .setupMessagingWithAutoIntegration()
            .withDefaultNotificationChannelId()
            .withDefaultNotificationIconResourceId(R.drawable.ic_dialog_alert)
            .withDefaultNotificationIconAccentColor()
            .withFlurryMessagingListener(flurryMessagingListener)
            .build()

The other issue is I don't want to put an .withDefaultNotificationChannelId(). According to the how to on their website - which seem out of date. I don't need to yet it tells me I have too.

Question why could this not be as easy as iOS version - that was a lot easier to install. But if anyone has a how to install with Kotlin - since Flurry support has not gotten back to me I would be grateful.


Solution

  • You need to define your listener. E.g.,

    import com.flurry.android.marketing.messaging.FlurryMessagingListener;
    
    FlurryMessagingListener flurryMessagingListener = new FlurryMessagingListener() {
        @Override
        public boolean onNotificationReceived(FlurryMessage flurryMessage) {
            return false;
        }
    
        @Override
        public boolean onNotificationClicked(FlurryMessage flurryMessage) {
            return false;
        }
    
        @Override
        public void onNotificationCancelled(FlurryMessage flurryMessage) {
        }
    
        @Override
        public void onTokenRefresh(String s) {
        }
    
        @Override
        public void onNonFlurryNotificationReceived(Object o) {
        }
    };
    

    And No, it's not required to define your own channel ID (by withDefaultNotificationChannelId). Flurry SDK will apply the default if no explicitly defined.