0

I have an app that has intent filters set to CategoryHome and CategoryDefault

[IntentFilter
  (
    new[] 
    { 
      Intent.ActionMain 
    }, 
    Categories = new[] 
    {
      Intent.CategoryHome, 
      Intent.CategoryDefault 
    }
  )
]

    public class MainActivity : Activity
...

Is it possible to change this on the fly?

1 Answers1

0

Pragmatically set Intent Categories - Home Button Action

You can't do this directly, but you could disable/enable particular Activities of your app. So you could have your Home app as disabled by default, then if a user wanted to use it, they could enable it programmatically.

You could refer to CommonsWare's answer :

You can neither enable, disable, or create <intent-filter>s programmatically.

However, in your case, you only have one <intent-filter> per component. In that case, you can enable and disable the component programmatically, via PackageManager and setComponentEnabledSetting(). In your case, enabling or disabling the activity would have the same basic effect as enabling or disabling its <intent-filter>.

Other useful link :

York Shen
  • 9,014
  • 1
  • 16
  • 40