@Retention(value=CLASS)
@Target(value=METHOD)
public @interface ReceiverAction
Should be used on a method that must respond to a specific action in an
EReceiver annotated class. The method name will be used as action
name unless the value() field is set.
The class MAY contain several ReceiverAction annotated methods.
The method annotated with ReceiverAction may have as parameters :
Context which will be the context given in
void onReceive(Context context, Intent intent)Intent which will be the intent given in
void onReceive(Context context, Intent intent)Parcelable or Serializable
parameters annotated with ReceiverAction.Extra which will be the
extra put in the intent. The key of this extra is the value of the annotation
ReceiverAction.Extra if set or the name of the parameter.
Example :
@EReceiver
public class MyIntentService extends BroadcastReceiver {
@ReceiverAction
void mySimpleAction(Intent intent) {
// ...
}
@ReceiverAction
void myAction(@ReceiverAction.Extra String valueString, Context context) {
// ...
}
@ReceiverAction
void anotherAction(@ReceiverAction.Extra("specialExtraName") String valueString, @ReceiverAction.Extra long valueLong) {
// ...
}
}
EReceiver| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String[] |
dataSchemes
Define a set of data schemes to filter the Intent.
|
java.lang.String |
value
Define the action's name.
|
public abstract java.lang.String value
public abstract java.lang.String[] dataSchemes
Copyright © 2010-2014. All Rights Reserved.