Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karte In App Message SDK is crashing on Android, when tapping on a push notification from SalesForce. #23

Open
SergioRUP opened this issue Apr 26, 2024 · 0 comments

Comments

@SergioRUP
Copy link

SergioRUP commented Apr 26, 2024

Expected Behavior

  • 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

  1. Send a push notification from SalesForce (or possible from any service other than Firebase) to the device.
  2. Tap the notification to open the app.
  3. 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")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant