public final class KletsPluginApi extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ACTION_RESULT_ASK_CHOICE
Used as result code for
BroadcastReceiver that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE. |
static int |
ACTION_RESULT_ASK_PARAM
Used as result code for
BroadcastReceivers that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE. |
static int |
ACTION_RESULT_ASYNC
Used as result code for
BroadcastReceivers that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE. |
static int |
ACTION_RESULT_OK
Used as result code for
BroadcastReceivers that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE. |
static String |
EXTRA_ACTION_ID
The lookup key used with
INTENT_EXECUTE_ACTION ordered broadcasts for a String containing the
action id for which KLets is firing the intent. |
static String |
EXTRA_ASYNC_PENDING_INTENT
This extra contains
PendingIntent that must be fired to notify to KLets when an asynchronous
action execution is completed. |
static String |
EXTRA_CHOICE_ID
Used as a String extra field set in the
BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_CHOICE. |
static String |
EXTRA_CHOICE_LABELS
Used as a String[] extra field set in the
BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_CHOICE. |
static String |
EXTRA_CHOICE_VALUES
Used as an array extra field set in the
BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_CHOICE. |
static String |
EXTRA_CHOICES
The lookup key used with
INTENT_EXECUTE_ACTION ordered broadcast for a Bundle containing a
key-value map with choices performed by the user till the intent fire. |
static String |
EXTRA_MESSAGE
Used as a String extra field set in the
BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_OK or
ACTION_RESULT_ASK_CHOICE. |
static String |
EXTRA_PARAMETER_ID
Used as a String extra field set in the
BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_PARAM. |
static String |
EXTRA_PARAMETERS
The lookup key used with
INTENT_EXECUTE_ACTION ordered broadcast for a Bundle containing a
key-value map with parameters said by the user till the intent fire. |
static String |
EXTRA_PENDING_INTENT
Used as a
PendingIntent extra field set in the BroadcastReceiver result extras or on the pending
intent from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_OK. |
static String |
EXTRA_RESULT_CODE
Extra to be set on the pending intent from
EXTRA_ASYNC_PENDING_INTENT to one of the
ACTION_RESULT_OK, ACTION_RESULT_ASK_PARAM or ACTION_RESULT_ASK_CHOICE values. |
static String |
INTENT_EXECUTE_ACTION
Ordered broadcast intent fired by KLets to execute an action of a plug-in.
|
static String |
INTENT_SESSION_START
Intent fired by KLets when a recognition session is started.
|
static String |
INTENT_SESSION_STOP
Intent fired by KLets when a recognition session is stopped.
|
static String |
PERMISSION_EXECUTE_TASK |
static String |
PERMISSION_QUERY_TYPE |
| Constructor and Description |
|---|
KletsPluginApi() |
| Modifier and Type | Method and Description |
|---|---|
static ApplicationInfo |
getAppWithPermission(Context context,
String permission) |
static boolean |
isPermissionAuthentic(Context context,
String permission) |
public static final String INTENT_SESSION_START
public static final String INTENT_SESSION_STOP
public static final String INTENT_EXECUTE_ACTION
Ordered broadcast intent fired by KLets to execute an action of a plug-in. KLets set the target application package on the intent, so only the application holding the target action plug-in will receive it.
The EXTRA_ACTION_ID extra indicates the action id for which KLets is asking the execution.
The EXTRA_PARAMETERS extra contains key/values pairs for parameters said by the user so far.
The EXTRA_CHOICES extra contains key/values pairs for choices performed by the user so far.
The BroadcastReceiver must set its resultCode to one of the ACTION_RESULT_OK,
ACTION_RESULT_ASK_PARAM, ACTION_RESULT_ASK_CHOICE or ACTION_RESULT_ASYNC
values.
public static final String EXTRA_ACTION_ID
INTENT_EXECUTE_ACTION ordered broadcasts for a String containing the
action id for which KLets is firing the intent.public static final String EXTRA_PARAMETERS
INTENT_EXECUTE_ACTION ordered broadcast for a Bundle containing a
key-value map with parameters said by the user till the intent fire.public static final String EXTRA_CHOICES
INTENT_EXECUTE_ACTION ordered broadcast for a Bundle containing a
key-value map with choices performed by the user till the intent fire.public static final String EXTRA_ASYNC_PENDING_INTENT
This extra contains PendingIntent that must be fired to notify to KLets when an asynchronous
action execution is completed.
public static final String EXTRA_RESULT_CODE
Extra to be set on the pending intent from EXTRA_ASYNC_PENDING_INTENT to one of the
ACTION_RESULT_OK, ACTION_RESULT_ASK_PARAM or ACTION_RESULT_ASK_CHOICE values.
This extra doesn't support the ACTION_RESULT_ASYNC value
public static final int ACTION_RESULT_OK
Used as result code for BroadcastReceivers that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE.
Use this result value when the action completed its work. KLets will then end its vocal session upon receiving this result. When setting this result code, the action must set a result extras with following extras:
EXTRA_MESSAGE: Can be set to a message that must be said before KLets quits but before to
launch the pending intent eventually set with EXTRA_PENDING_INTENT.
EXTRA_PENDING_INTENT: Can be set to a PentingIntent that must be fired just before KLets
quits and after that any bluetooth and audio connections have been closed.
public static final String EXTRA_MESSAGE
Used as a String extra field set in the BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_OK or
ACTION_RESULT_ASK_CHOICE.
public static final String EXTRA_PENDING_INTENT
Used as a PendingIntent extra field set in the BroadcastReceiver result extras or on the pending
intent from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_OK.
public static final int ACTION_RESULT_ASYNC
Used as result code for BroadcastReceivers that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE.
Use this result when an action execution must performs long or asynchronous operations that cannot be performed
inside a BroadcastReceiver.
Once the plugin has completed its asynchronous task, it must fire the pending intent passed with the extra
EXTRA_ASYNC_PENDING_INTENT , and must set, passing to it a new Intent, the extra EXTRA_RESULT_CODE
with any other needed extras the same values that would be set by the BroadcastReceiver with
BroadcastReceiver.setResultCode(int) and BroadcastReceiver.getResultExtras(boolean).
This result value can't be set for the extra EXTRA_RESULT_CODE
public static final int ACTION_RESULT_ASK_PARAM
Used as result code for BroadcastReceivers that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE.
Use this result when an action needs an additional parameter missing from the EXTRA_PARAMETERS
extra. When setting this result code, the action must set a result extras with following extras:
EXTRA_PARAMETER_ID: must be set to the key of the parameter to ask.INTENT_EXECUTE_ACTION
intent as soon as the parameter is correctly recognized.
public static final String EXTRA_PARAMETER_ID
Used as a String extra field set in the BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_PARAM.
It must contains a valid ID for a parameter declared inside the action xml descriptor.
public static final int ACTION_RESULT_ASK_CHOICE
Used as result code for BroadcastReceiver that handle the INTENT_EXECUTE_ACTION intent, or as value for
the extra EXTRA_RESULT_CODE.
Use this result when the action needs to ask to select an element from a list. When setting this
result code, the action must also set the following extras on the BroadcastReceiver result extras or on
the pending intent from EXTRA_ASYNC_PENDING_INTENT:
EXTRA_MESSAGE: must be set to a message that must be said to the user.EXTRA_CHOICE_ID: must be set to an identifier that can used by the plugin to identify the choice
performed by the user from EXTRA_CHOICES of the next fired intent INTENT_EXECUTE_ACTION.
EXTRA_CHOICE_LABELS: must be set to an array of String with labels to use for the choice list.EXTRA_CHOICE_VALUES: must be set to an array of Parcelable object to use for the choice list. The element
selected by the user will be set on the bundle extra EXTRA_CHOICES.
INTENT_EXECUTE_ACTION, with the extra EXTRA_CHOICES updated to contains the value selected by
the user.
public static final String EXTRA_CHOICE_LABELS
Used as a String[] extra field set in the BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_CHOICE.
It must contains the same number of elements set on extra EXTRA_CHOICE_VALUES.
public static final String EXTRA_CHOICE_VALUES
Used as an array extra field set in the BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_CHOICE.
The array type can be one of the following:
Parcelable[]
It must contains the same number of elements set on extra EXTRA_CHOICE_LABELS.
public static final String EXTRA_CHOICE_ID
Used as a String extra field set in the BroadcastReceiver result extras or on the pending intent
from EXTRA_PENDING_INTENT when the result code is ACTION_RESULT_ASK_CHOICE.
It must contains a unique ID that will be used be the action to restrieve the selected value from the bundle
inside the extra EXTRA_CHOICES.
public static String PERMISSION_EXECUTE_TASK
public static String PERMISSION_QUERY_TYPE
public static boolean isPermissionAuthentic(Context context, String permission)
public static ApplicationInfo getAppWithPermission(Context context, String permission)
Copyright © 2013. All Rights Reserved.