Odin
03/23/2022, 9:49 AMactionRunCalback
with an action that uses a deeplink to open the app. We're doing this because our Glance widget is in a different module than our MainActivity
and then to avoid CircularDependencyException
. However, we're seeing a rather strange error from Crashlytics saying java.lang.IllegalArgumentException: List adapter activity trampoline invoked without specifying target intent.
. I saw that there was a check in ActionTrampoline.kt
that could throw this. Has anyone else seen this before? 😄 Stacktrace in thread 🧵Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.healthfitnessnordic.gxbooking/androidx.glance.appwidget.action.InvisibleActionTrampolineActivity}: java.lang.IllegalArgumentException: List adapter activity trampoline invoked without specifying target intent.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6124)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:890)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:780)
Caused by java.lang.IllegalArgumentException: List adapter activity trampoline invoked without specifying target intent.
at androidx.glance.appwidget.action.ActionTrampolineKt.launchTrampolineAction(ActionTrampoline.kt:86)
at androidx.glance.appwidget.action.InvisibleActionTrampolineActivity.onCreate(InvisibleActionTrampolineActivity.kt:31)
at android.app.Activity.performCreate(Activity.java:6699)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6124)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:890)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:780)
Piotr Prus
03/24/2022, 6:55 AMval appIntent = Intent(context, Class.forName("com.myname.android.main.MainActivity")).apply {
addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
}
than use it with `actionStartActivity`:
.clickable(onClick = actionStartActivity(intent = appIntent))
Odin
04/08/2022, 6:55 AMActionCallback
class we use looks like this
class OpenAppAction : ActionCallback {
override suspend fun onRun(context: Context, glanceId: GlanceId, parameters: ActionParameters) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("deeplink")).apply {
setPackage(context.packageName)
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
context.startActivity(intent)
}
}
We also use the
onClick = actionStartActivity<Activity>(),
For opening different parts of the app that the module can depend on 😄