Is `actionStartActivity` with an `Intent` broken o...
# glance
o
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
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
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
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
l
Having same issue. In my case I have to create Intent to pass Uri for deeplinking and in another case I have to start service intent by using actionRunCallback. Glance should allow to pass those flags ourselves or to pass PendingIntent rather than only Intent
169 Views