Class 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.
-
Constructor Summary
ConstructorsConstructorDescriptionIntentDeclaration(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) Framework entry point: builds a declaration. -
Method Summary
Modifier and TypeMethodDescriptionThe longer explanation shown alongside the title, or an empty string.The consumers this intent is offered to.getId()The stable id the platform and the wire format use.The route template this intent navigates to, or an empty string.getParameter(String name) The parameter with this name, or null.The declared parameters, in the order the handler takes them.The spoken phrases that invoke this intent.intThe handler's own time budget in seconds, before the framework gives up and reports a failure to the platform.getTitle()The human-readable name shown in the Shortcuts app and the simulator.booleanTrue when the platform should confirm with the user before running this.booleanTrue when the platform may offer this intent before the user has ever run it.booleanTrue when this intent is offered to the given consumer.booleanTrue when this intent is allowed to run without bringing the app to the foreground.booleanTrue when an invocation of this intent actually runs with no window.toString()Returns a string representation of the object.
-
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) Framework entry point: builds a declaration. Called by generated code and for aDynamicIntent; applications do not construct these.
-
-
Method Details
-
getId
The stable id the platform and the wire format use. -
getTitle
The human-readable name shown in the Shortcuts app and the simulator. -
getDescription
The longer explanation shown alongside the title, or an empty string. -
isHeadless
public boolean isHeadless()True when this intent is allowed to run without bringing the app to the foreground. See the package documentation for what a headless handler may and may not touch. -
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 throughopenAppWhenRun, 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()True when the platform may offer this intent before the user has ever run it. A false value means the intent only appears after a donation. -
isDestructive
public boolean isDestructive()True when the platform should confirm with the user before running this. -
getOpensRoute
The route template this intent navigates to, or an empty string. A non-empty value is what makes the platform open the app when the intent runs. -
getTimeoutSeconds
public int getTimeoutSeconds()The handler's own time budget in seconds, before the framework gives up and reports a failure to the platform. -
getPhrases
-
getParameters
The declared parameters, in the order the handler takes them. -
getExposure
-
isExposedTo
True when this intent is offered to the given consumer.
Parameters
e: the consumer to test
-
getParameter
The parameter with this name, or null.
Parameters
name: the parameter name
-
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-