public final class IntentDeclaration
- Object
- IntentDeclaration
Everything the framework knows about one declared intent.
The build-time processor turns each AppIntent method into one of these and
bakes it into the generated registry, so the list is fixed by the time the
app runs – which is exactly what the platforms require, since their intent
catalogues are compiled into the native binary.
Applications read declarations through Intents.getDeclarations(); the
simulator’s Intents window is built entirely from them, so what a developer
sees there is what actually shipped.
Constructors
Methods
public String getId() | The stable id the platform and the wire format use. |
public String getTitle() | The human-readable name shown in the Shortcuts app and the simulator. |
public String getDescription() | The longer explanation shown alongside the title, or an empty string. |
public boolean isHeadless() | True when this intent is allowed to run without bringing the app to the foreground. |
public boolean runsHeadless() | True when an invocation of this intent actually runs with no window. |
public boolean isDiscoverable() | True when the platform may offer this intent before the user has ever run it. |
public boolean isDestructive() | True when the platform should confirm with the user before running this. |
public String getOpensRoute() | The route template this intent navigates to, or an empty string. |
public int getTimeoutSeconds() | The handler’s own time budget in seconds, before the framework gives up and reports a failure to the platform. |
public List<String> getPhrases() | The spoken phrases that invoke this intent. |
public List<IntentParameterInfo> getParameters() | The declared parameters, in the order the handler takes them. |
public List<Exposure> getExposure() | The consumers this intent is offered to. |
public boolean isExposedTo(Exposure e) | True when this intent is offered to the given consumer. |
public IntentParameterInfo getParameter(String name) | The parameter with this name, or null. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
IntentDeclaration
public IntentDeclaration(String id, String title, String description, boolean headless, boolean discoverable, boolean destructive, String opensRoute, int timeoutSeconds, List<String> phrases, List<IntentParameterInfo> parameters, List<Exposure> exposure)DynamicIntent; applications do not construct these.Method details
getId
public String getId()getTitle
public String getTitle()getDescription
public String getDescription()isHeadless
public boolean isHeadless()runsHeadless
public boolean runsHeadless()True when an invocation of this intent actually runs with no window.
Not the same question as isHeadless(), which reports what the declaration said. An
intent that names a route is foregrounded however it was declared, because the route has
to open somewhere a person can see – iOS decides that statically through
openAppWhenRun, and every Java caller has to reach the same answer.
It exists because that combination was resolved separately in four places – the Android trampoline, the service’s post-bootstrap recheck, the parked-request path and the shortcut generator – and each was fixed as its own bug. One definition, one answer.
isDiscoverable
public boolean isDiscoverable()isDestructive
public boolean isDestructive()getOpensRoute
public String getOpensRoute()getTimeoutSeconds
public int getTimeoutSeconds()getPhrases
public List<String> getPhrases()getParameters
public List<IntentParameterInfo> getParameters()getExposure
public List<Exposure> getExposure()isExposedTo
public boolean isExposedTo(Exposure e)Parameters
eExposure- the consumer to test
getParameter
public IntentParameterInfo getParameter(String name)Parameters
nameString- the parameter name
toString
public String toString()