@@ -736,21 +736,23 @@ protected Void doInBackground(Void... params) {
736736 Log .d ("No variants received from the server." );
737737 }
738738
739- // Get notification channels and groups.
740- JSONArray notificationChannels = response .optJSONArray (
741- Constants .Keys .NOTIFICATION_CHANNELS );
742- JSONArray notificationGroups = response .optJSONArray (
743- Constants .Keys .NOTIFICATION_GROUPS );
744- String defaultNotificationChannel = response .optString (
745- Constants .Keys .DEFAULT_NOTIFICATION_CHANNEL );
746-
747- // Configure notification channels and groups
748- LeanplumNotificationChannel .configureNotificationGroups (
749- context , notificationGroups );
750- LeanplumNotificationChannel .configureNotificationChannels (
751- context , notificationChannels );
752- LeanplumNotificationChannel .configureDefaultNotificationChannel (
753- context , defaultNotificationChannel );
739+ if (LeanplumNotificationChannel .isNotificationChannelSupported (context )) {
740+ // Get notification channels and groups.
741+ JSONArray notificationChannels = response .optJSONArray (
742+ Constants .Keys .NOTIFICATION_CHANNELS );
743+ JSONArray notificationGroups = response .optJSONArray (
744+ Constants .Keys .NOTIFICATION_GROUPS );
745+ String defaultNotificationChannel = response .optString (
746+ Constants .Keys .DEFAULT_NOTIFICATION_CHANNEL );
747+
748+ // Configure notification channels and groups
749+ LeanplumNotificationChannel .configureNotificationGroups (
750+ context , notificationGroups );
751+ LeanplumNotificationChannel .configureNotificationChannels (
752+ context , notificationChannels );
753+ LeanplumNotificationChannel .configureDefaultNotificationChannel (
754+ context , defaultNotificationChannel );
755+ }
754756
755757 String token = response .optString (Constants .Keys .TOKEN , null );
756758 Request .setToken (token );
0 commit comments