zundi
zundi

Reputation: 2457

Set deep linking URI dynamically in Android

The Android deep linking docs indicate that the URI should be set in the AndroidManifest file.

Is there any way to set this value dynamically at run time, instead of in the AndroidManifest?

Upvotes: 2

Views: 588

Answers (2)

nixan
nixan

Reputation: 523

Of course you cannot edit the intent filter but you can enable/disable the component that's associated with that filter. For example you do not want to intercept http://yoursite.com ACTION_VIEW Intent until your user is authenticated. To do that you have to set android:enabled="false" and later in the end of the authentication you should enable that component using PackageManager:

PackageManager pm = getPackageManager(); pm.setComponentEnabledSetting(new ComponentName(this, ActivityC.class), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1007409

No, sorry. You cannot add an IntentFilter to an activity at runtime.

Upvotes: 1

Related Questions