Annotation Type IntentParam


@Retention(CLASS) @Target(PARAMETER) public @interface IntentParam

Names and describes one parameter of an AppIntent handler.

Every parameter of a handler needs one, except an optional leading com.codename1.intents.IntentContext. Supported types are String, int, long, float, double, boolean, java.util.Date, and any class annotated IntentEntity.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The parameter name used on the wire and in phrase placeholders.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The value substituted when an optional parameter is absent.
    A closed vocabulary of accepted values.
    boolean
    Whether the intent can run without this value.
    What the platform asks when it needs this value -- "Which playlist?".
  • Element Details

    • value

      String value
      The parameter name used on the wire and in phrase placeholders. Required.
    • title

      String title

      What the platform asks when it needs this value -- "Which playlist?".

      Write it as a question to the user, because on iOS that is literally what Siri says out loud. Defaults to the parameter name, which is almost never what you want a user to hear.

      Default:
      ""
    • required

      boolean required
      Whether the intent can run without this value. An unfilled required parameter is what triggers the platform's own picker.
      Default:
      true
    • defaultValue

      String defaultValue

      The value substituted when an optional parameter is absent.

      Only meaningful alongside required = false, and the build says so rather than letting the two contradict each other: the platforms resolve that contradiction differently, one treating the parameter as satisfied by the default and another still prompting for it.

      It must also be a value the parameter's type can actually hold, which the build checks too -- a default it cannot parse would otherwise become 0, false or null at runtime.

      Default:
      ""
    • options

      String[] options

      A closed vocabulary of accepted values. String parameters only.

      That restriction is enforced at build time because it is the only place it can be: the framework validates a vocabulary for strings and projects it to an iOS choice list, and nothing does either for other types -- so options elsewhere would advertise a restriction that nothing applies.

      The platform offers these as choices rather than asking for free text, and the framework rejects anything else before your handler runs. Use it instead of declaring an enum type: an enum would need its own resolution machinery on every platform for no gain over a checked string.

      Default:
      {}