Skip to content

Commit 00139a0

Browse files
abdulraqeeb33AR Abdul Azeez
authored andcommitted
bug: catch exception if opening a notification fails (#2508)
Co-authored-by: AR Abdul Azeez <[email protected]>
1 parent 6fda524 commit 00139a0

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
@@ -271,6 +272,13 @@ internal class NotificationLifecycleService(
271272
Logging.info("SDK not showing an Activity automatically due to it's settings.")
272273
}
273274
} catch (e: JSONException) {
275+
Logging.error("Could not parse JSON to open notification activity.")
276+
e.printStackTrace()
277+
} catch (e: ActivityNotFoundException) {
278+
Logging.error("No activity found to handle notification open intent.")
279+
e.printStackTrace()
280+
} catch (e: Exception) {
281+
Logging.error("Could not open notification activity.")
274282
e.printStackTrace()
275283
}
276284
}

0 commit comments

Comments
 (0)