Skip to content

Commit ee6960c

Browse files
authored
Added try-catch and logging for future stacktraces (#939)
* No way of knowing exactly what argument is causing this issue * Added logging for future evaluation * Added try-catch to prevent crashing
1 parent a28e1c2 commit ee6960c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/NotificationChannelManager.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,17 @@ else if ("null".equals(sound) || "nil".equals(sound))
174174
channel.setShowBadge(payload.optInt("bdg", 1) == 1);
175175
channel.setBypassDnd(payload.optInt("bdnd", 0) == 1);
176176

177-
notificationManager.createNotificationChannel(channel);
177+
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.VERBOSE, "Creating notification channel with channel:\n" + channel.toString());
178+
try {
179+
notificationManager.createNotificationChannel(channel);
180+
} catch (IllegalArgumentException e) {
181+
// TODO: Remove this try-catch once it is figured out which argument is causing Issue #895
182+
// try-catch added to prevent crashing from the illegal argument
183+
// Added logging above this try-catch so we can evaluate the payload of the next victim
184+
// to report a stacktrace
185+
// https://github.com/OneSignal/OneSignal-Android-SDK/issues/895
186+
e.printStackTrace();
187+
}
178188
return channel_id;
179189
}
180190

0 commit comments

Comments
 (0)