plaidev / karte-android-sdk

KARTE SDK for Android
https://karte.io/
Apache License 2.0
5 stars 3 forks source link

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

Open SergioRUP opened 7 months ago

SergioRUP commented 7 months ago

Expected Behavior

Current Behavior

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

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") }