sdex / ActivityManager

Launch any application activity
Apache License 2.0
604 stars 34 forks source link

Support `setData()` #8

Closed opk12 closed 2 years ago

opk12 commented 2 years ago

I want to work around a Matrix Element bug in making shortcuts; I want to choose a custom icon for a shortcut to Firefox Fennec.

I can do both with this app, if it lets me setData() to a custom URI.

// im.vector.app.features.link.LinkHandlerActivity - mozilla.components.feature.pwa.WebAppLauncherActivity
Intent intent = new Intent();
intent.setClassName(packageName, activityName);
intent.setData(android.net.Uri.parse(permalink));
ctx.startActivity(intent);
sdex commented 2 years ago

You can create any intent and set the data field to whatever you want.

photo1650005330

opk12 commented 2 years ago

How to reach that window? On 4.1.4 I have the same screens as here and the dialog Edit shortcut only has the icon and label.

sdex commented 2 years ago

You need to open Activity Manager in Activity Manager, then launch IntentBuilderActivity, create the custom intent and launch it. From the history you can create a shortcut for the intent. photo1650015430

opk12 commented 2 years ago

For myself: the history is HistoryActivity and is at the top-right in the Intent launcher activity. To create the shortcut, first launch the intent with the V button at the bottom, then long-tap on the history entry.

opk12 commented 2 years ago

Many thanks. I have not found even a very brief mention in-app, is there a specific reason?

sdex commented 2 years ago

This was not a very popular feature and I decided to not support it anymore but didn't want to remove it from the app. It's neither mentioned in the UI nor documented, but it reflects android API for the Intent, so any android developer can easily use it.