Skip to content

Commit 1807588

Browse files
abdulraqeeb33AR Abdul Azeez
andauthored
bug: catch exception if opening a notification fails (#2508)
Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
1 parent 7569b81 commit 1807588

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/internal/lifecycle/impl/NotificationLifecycleService.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.onesignal.notifications.internal.lifecycle.impl
22

33
import android.app.Activity
4+
import android.content.ActivityNotFoundException
45
import android.content.Context
56
import com.onesignal.common.AndroidUtils
67
import com.onesignal.common.JSONUtils
@@ -282,6 +283,13 @@ internal class NotificationLifecycleService(
282283
Logging.info("SDK not showing an Activity automatically due to it's settings.")
283284
}
284285
} catch (e: JSONException) {
286+
Logging.error("Could not parse JSON to open notification activity.")
287+
e.printStackTrace()
288+
} catch (e: ActivityNotFoundException) {
289+
Logging.error("No activity found to handle notification open intent.")
290+
e.printStackTrace()
291+
} catch (e: Exception) {
292+
Logging.error("Could not open notification activity.")
285293
e.printStackTrace()
286294
}
287295
}

0 commit comments

Comments
 (0)