public final class IntentAgentHelper extends Object
IntentAgent objects and to obtain
the bundle name, UID, and hash code value of an IntentAgent object.
The methods provided by this class are all static and can be called without creating an object of this class.
SystemCapability.Notification#ANS| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static void |
cancel(IntentAgent agent) |
Cancels an
IntentAgent. |
static String |
getBundleName(IntentAgent agent) |
Obtains the bundle name of an
IntentAgent. |
static int |
getHashCode(IntentAgent agent) |
Obtains the hash code value of an
IntentAgent. |
static IntentAgent |
getIntentAgent(Context context,
IntentAgentInfo paramsInfo) |
Obtains an
IntentAgent object. |
static int |
getUid(IntentAgent agent) |
Obtains the user ID (UID) of an
IntentAgent. |
static boolean |
judgeEquality(IntentAgent agent,
IntentAgent otherAgent) |
Checks whether two
IntentAgent objects are the same. |
static void |
triggerIntentAgent(Context context,
IntentAgent agent,
IntentAgent.OnCompleted onCompleted,
EventHandler handler,
TriggerInfo paramsInfo) |
Triggers an
IntentAgent. |
public static IntentAgent getIntentAgent(Context context, IntentAgentInfo paramsInfo)
IntentAgent object.
The IntentAgent class does not have any constructor, and you can only use this method to create an
IntentAgent object.
context - Indicates the context of the caller. This parameter cannot be null.paramsInfo - Indicates the IntentAgentInfo object that contains parameters of the
IntentAgent object to create.IntentAgent object.public static void triggerIntentAgent(Context context, IntentAgent agent, IntentAgent.OnCompleted onCompleted, EventHandler handler, TriggerInfo paramsInfo)
IntentAgent.
After this method is called, events associated with the specified IntentAgent will be executed,
such as starting an ability or sending a common event.
context - Indicates the context of the caller. This parameter cannot be null.agent - Indicates the IntentAgent to trigger.onCompleted - Indicates the callback method to be called after the IntentAgent is triggered.
This parameter can be null.handler - Indicates the thread for executing the callback indicated by onCompleted.
If this parameter is null, the callback method will be executed in a thread in the thread pool of
the current process.paramsInfo - Indicates the TriggerInfo object that contains triggering parameters.public static void cancel(IntentAgent agent)
IntentAgent.
Only the application that creates the IntentAgent can cancel it.
agent - Indicates the IntentAgent to cancel.public static boolean judgeEquality(IntentAgent agent, IntentAgent otherAgent)
IntentAgent objects are the same.agent - Indicates one of the IntentAgent object to compare.otherAgent - Indicates the other IntentAgent object to compare.true If the two objects are the same; returns false otherwise.public static int getHashCode(IntentAgent agent)
IntentAgent.agent - Indicates the IntentAgent whose hash code value is to be obtained.IntentAgent.public static String getBundleName(IntentAgent agent)
IntentAgent.agent - Indicates the IntentAgent whose bundle name is to be obtained.IntentAgent if any; returns null otherwise.public static int getUid(IntentAgent agent)
IntentAgent.agent - Indicates the IntentAgent whose UID is to be obtained.IntentAgent if any; returns -1 otherwise.