Enhance BroadcastReceivers - PerfectCarl/androidannotations GitHub Wiki
Since AndroidAnnotations 2.4
You can enhance an Android BroadcastReceiver with the @EReceiver annotation:
@EReceiver
public class MyReceiver extends BroadcastReceiver {
}You can then start using most AA annotations, except the ones related to views and extras:
@EReceiver
public class MyReceiver extends BroadcastReceiver {
@SystemService
NotificationManager notificationManager;
@Bean
SomeObject someObject;
}Your activity/fragment/service can be notified of intents using the @Receiver annotation, instead of declaring a BroadcastReceiver.
@EActivity
public class MyActivity extends Activity {
@Receiver(actions = "org.androidannotations.ACTION_1")
protected void onAction1() {
}
}More information about the @Receiver annotation.
Since AndroidAnnotations 3.1