Now that you have implemented Android AppFunctions, how to conditionally make them available?

If you haven’t yet played around with adding Android AppFunctions to your app, check out my blog post to get started, and get testing! Just note, as of writing this article (October 2026), the AppFunctions API is in a private preview with trusted testers, so you are not able to test it out immediately in a production app — but get your app ready now!
Android AppFunctions are a great idea to enable on device models to interact with your app, but there are several reasons why you may not want them enabled all the time:
- Require user consent: Before sharing private data with the LLM, you might want to ask the user first, giving them a chance to decide whether to share it and how much to share.
- Feature toggle: Extra protection can sometimes be good. You can put some or all of your AppFunctions behind a feature toggle and disable them remotely if something goes wrong.
- Pro feature: If implementing your AppFunction features has been a significant investment in time for you, you may not want to give all users access for free! If you have a pro or paid version of your app, you can enable the functions for them, and disable them for free users.
No matter what the reason, there is an easy way to do this!
Disabling AppFunctions by default
It all goes back to the @AppFunctionDeclaration annotation. We first saw this when writing our AppFunctions (where we had to set isDescribedByKDoc = true to use our KDoc to describe the function). It has another parameter isEnabled. This is true by default, but if we instead set this to false then we can enable and disable the functions at runtime.
So as an example:
When disabling the functions, we can verify this in the testing app:

Now that we have them disabled, how do we re-enable them again?
Enabling AppFunctions at runtime
In order to enable AppFunctions when the user gives their permission, they buy the paid version of your app or your feature toggle turns on, it is pretty straight forward using the AppFunctionManager:
Here, we take each function identifier (made up from the package name, service name and function name) and then set each one enabled as needed. You could decide to only make certain ones enabled if that makes sense for your app, or disable them later if needed.
setAppFunctionEnabled is a suspend function so you will need to do this within a coroutine. There is also isAppFunctionEnabled available if you want to check at runtime if an AppFunction is enabled.
If we put this together with a simple prompt to ask the user for their permission:

Easy and enabled!
For more AppFunctions fun, check out my previous blog posts in this series:
If you want to check out the sample code, you can find my Game Night Guru app here:
GitHub – KatieBarnett/GameNightGuru at extension
AI, Meet App: Enable or Disable Android AppFunctions at runtime was originally published in ProAndroidDev on Medium, where people are continuing the conversation by highlighting and responding to this story.