Class DynamicIntent
A named parameterization of an intent your application already declares -- "reorder my usual", "call Mum" -- built from data only known at runtime.
Map<String, Object> usual = new HashMap<String, Object>();
usual.put("shop", "shop-7");
usual.put("size", "large");
Intents.registerDynamicIntent(new DynamicIntent("usual_coffee", "order_coffee",
"Order my usual").bind(usual));
Why it must name a base intent
It runs by running the intent it names, with the bound values filled in. It cannot introduce a new capability: the native catalogue is compiled into the app, so a genuinely new verb could never reach the platform, and a runtime API that appeared to add one would work in the simulator and silently do nothing on a device.
Binding to a base intent is also what makes it invokable at all -- there is a handler to run, which is the whole point of registering it.
-
Constructor Summary
ConstructorsConstructorDescriptionDynamicIntent(String id, String baseIntentId, String title) Creates a parameterization. -
Method Summary
-
Constructor Details
-
DynamicIntent
-
-
Method Details
-
bind
Binds values for the base intent's parameters. Anything supplied at invocation time wins, so a bound value is a default rather than a lock.
Parameters
params: the values to bind
Returns
this parameterization, for chaining
-
bind
Binds one value.
Parameters
name: the parameter namevalue: the value to bind
Returns
this parameterization, for chaining
-
getId
-
getBaseIntentId
The declared intent this runs. -
getTitle
-
getBoundParameters
-
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())
-