It would be excellent to be able to do something like this inside a fragment or activity:
@EReceiver({ACTION_ONE, ACTION_TWO})
BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (ACTION_ONE.equals(intent.getAction()) {
// ...
} else if (ACTION_TWO.equals(intent.getAction()) {
// ...
}
}
}
And have AndroidAnnotations fill in the registerReceiver() with IntentFilter in onResume() (or onCreate()) and unregisterReceiver() in onPause() (or onDestroy()).
Or, even better, just annotate methods:
@EReceiverMethod(ACTION_ONE)
void onReceiveOne(Context context, Intent intent, BroadcastReceiver receiver) {}
@EReceiverMethod({ACTION_TWO, ACTION_THREE)
void onReceiveTwoOrThree(Context context, Intent intent, BroadcastReceiver receiver) {}
and have the receiver arg be optional, in case you're using sticky broadcasts, or something.
I'd love to work on this when I find time, just looking for input on the best way to approach it, IE: when to register/unregister, should that be an argument to the annotation, do we want to annotate methods, or just the object, etc.
It would be excellent to be able to do something like this inside a fragment or activity:
And have AndroidAnnotations fill in the
registerReceiver()withIntentFilterinonResume()(oronCreate()) andunregisterReceiver()inonPause()(oronDestroy()).Or, even better, just annotate methods:
and have the receiver arg be optional, in case you're using sticky broadcasts, or something.
I'd love to work on this when I find time, just looking for input on the best way to approach it, IE: when to register/unregister, should that be an argument to the annotation, do we want to annotate methods, or just the object, etc.