urbanairship / android-library

Urban Airship Android SDK
Other
111 stars 122 forks source link

Custom NotificationChannel via AirshipConfigOptions does not work #172

Closed StefMa closed 3 years ago

StefMa commented 3 years ago

Preliminary Info

What Airship dependencies are you using?

com.urbanairship.android:urbanairship-fcm:14.1.1

What are the versions of any relevant development tools you are using?

Android Studio

Report

What unexpected behavior are you seeing?

The default NotificationChannel name "Notifications" are used

What is the expected behavior?

I want to use the NotificationChannel name I set up via the AirshipConfigOptions.Builders

What are the steps to reproduce the unexpected behavior?

Because of legal reasons we have to start the airship at a later stage, not at start up. But anyways. We start the ship as soon as the user press a button "agree with marketing". Then we do a few setup with the AirshipConfigOptions.Builder() and finally start UAirship.takeOff(application, airshipConfigOptions) Eveything works, but it seems the call AirshipConfigOptions.Builder.setNotificationChannel is ignored. Because as soon as I send a notification it will be "send" to the default Notification NotificationChannel.

Do you have logging for the issue?

Unfortunately no

rlepinski commented 3 years ago

Are you able to reproduce this easily? Could you verify the notification channel is actually created? Do you have a custom notification provider?

The notification provider is ultimately the one that decides the channel. The default notification provider will use the channel in this order: push, config, default. It will also fallback to the default channel if the resulting channel does not exist.

StefMa commented 3 years ago

Thanks for the response @rlepinski! It pushed me into the right direction.

After checking the logs again I do see the following:

UALib: Notification channel Marketing does not exist. Falling back to com.urbanairship.default

I guess I missunderstood your documentation.

I thought the Airship SDK will create a notification channel for me, while I only put the name into the AirshipConfigOptions.Builders. But it seems that the SDK don't do that. It will only use an existing NotificationChannel with that id, if available! Otherwise it fallsback to the default one.

Can you confirm that behave? And maybe create an internal ticket to adjust your docs 😅

Thanks you! :)

rlepinski commented 3 years ago

Thanks for the feedback, I created a ticket to make it more clear on the channel fallback behavior. Glad you got it working!