My app has two widgets, and I'd like to hide one of them in the list of homescreen widgets unless the user has purchased the pro version of the app (which is done via in-app billing).
As a widget has to be declared in the manifest, and then appears in the list when a user goes to create one, is there any way to prevent the "premium" widget from showing unless the condition has been met?
One way around it would be to keep it in the list, allowing the user to create it, and then setting the layout to just say "Upgrade to pro" if it hasn't been unlocked rather than using its proper layout. I don't really like this option as it's not great ux, avoiding it would be preferable.
you can use setComponentEnabledSetting:
so add it to the manifest ( disabled ) and enable it when the user has payed