The app should start and display the content from the notification without crashing.
Current Behavior
The app crashes with an UnsupportedOperationException indicating a non-hierarchical URI problem in PreviewParams, as soon as the user taps on a push notification and the app starts.
Steps to Reproduce
Send a push notification from SalesForce (or possible from any service other than Firebase) to the device.
Tap the notification to open the app.
Observe the crash on startup.
SDK Version
core 2.25.0
inappmessaging 2.19.0
Android Version
Android Version 13 or higher
Build Environment
Android Studio Iguana | 2023.2.1 Patch 1
Gradle Version 8.4
Android Gradle Plugin Version 8.3.2
Context Details
Notifications sent from Firebase -> Doesn't crash
Notifications sent from SalesForce (or other) -> Crash
Removing the implementation 'io.karte.android:notifications:2.11.0' from gradle -> Same Crash
Removing the implementation 'io.karte.android:inappmessaging:2.19.0' from gradle -> Doesn't crash
Logs
Process:
java.lang.UnsupportedOperationException: This isn't a hierarchical URI.
at android.net.Uri.getQueryParameter(Uri.java:1720)
at io.karte.android.inappmessaging.internal.preview.PreviewParams.(PreviewParams.kt:27)
at io.karte.android.inappmessaging.InAppMessaging.onActivityStarted(InAppMessaging.kt:143)
at android.app.Application.dispatchActivityStarted(Application.java:420)
at android.app.Activity.dispatchActivityStarted(Activity.java:1451)
at android.app.Activity.onStart(Activity.java:1969)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:344)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1510)
at android.app.Activity.performStart(Activity.java:8616)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4204)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Possible Implementation
if (uri.isHierarchical()) {
val parameter = uri.getQueryParameter("key")
// Proceed with existing logic
} else {
// Log the error or handle the non-hierarchical URI case appropriately
Log.e("PreviewParams", "Non-hierarchical URI received: $uri")
}
Expected Behavior
Current Behavior
Steps to Reproduce
SDK Version
Android Version
Build Environment
Context Details
Logs
Process: java.lang.UnsupportedOperationException: This isn't a hierarchical URI. at android.net.Uri.getQueryParameter(Uri.java:1720) at io.karte.android.inappmessaging.internal.preview.PreviewParams.(PreviewParams.kt:27)
at io.karte.android.inappmessaging.InAppMessaging.onActivityStarted(InAppMessaging.kt:143)
at android.app.Application.dispatchActivityStarted(Application.java:420)
at android.app.Activity.dispatchActivityStarted(Activity.java:1451)
at android.app.Activity.onStart(Activity.java:1969)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:344)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1510)
at android.app.Activity.performStart(Activity.java:8616)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4204)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Possible Implementation
if (uri.isHierarchical()) { val parameter = uri.getQueryParameter("key") // Proceed with existing logic } else { // Log the error or handle the non-hierarchical URI case appropriately Log.e("PreviewParams", "Non-hierarchical URI received: $uri") }