https://kotlinlang.org logo
#glance
Title
# glance
o

orz

11/09/2023, 3:40 PM
Is
actionStartActivity
with an
Intent
broken on Android 14? I’ve got the following set up:
Copy code
...
val intent = Intent(
    Intent.Action_VIEW,
    widgetDeepLinkUrl.toUri(),
).apply {
    putExtra("fromWidget", true)
}
...
    modifier = GlanceModifier
        .actionStartActivity(
            intent = intent 
        )
...
The above works fine to deep link into the app in versions < 14. As a side note, I can get this to work on Android 14, if I use a custom
ActionCallback
where I call
context.startActivity(intent)
manually instead of just passing an
Intent
.
b

bbade_

11/09/2023, 5:08 PM
Are there any messages in logcat that could help diagnose?
And because it's using a uri, does it work on android 14 if you launch it from adb using
am start
?
o

orz

11/09/2023, 5:22 PM
Are there any messages in logcat that could help diagnose?
Ah, yes—we have this:
Copy code
Unrecognized Action: androidx.glance.appwidget.action.StartActivityIntentAction@646b689
                                                                                                                java.lang.IllegalArgumentException: com.myapp.myapp.hop.debug: Targeting U+ (version 34 and above) disallows creating or retrieving a PendingIntent with FLAG_MUTABLE, an implicit Intent within and without FLAG_NO_CREATE and FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT for security reasons. To retrieve an already existing PendingIntent, use FLAG_NO_CREATE, however, to create a new PendingIntent with an implicit Intent use FLAG_IMMUTABLE.
👀 1
b

bbade_

11/09/2023, 5:28 PM
Hmm, i can reproduce that as well on a 34 emulator, i'll take a look
The quick fix, however, would be to specify a component name
9 Views