SystemServices - shiraji/androidannotations GitHub Wiki

Since AndroidAnnotations 1.0

Standard Android System Service injection

Retrieving Android System Services requires remembering the name of the constant, and casting the retrieved object.

notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

@SystemService

The @SystemService annotation indicates that an activity field should be injected with the corresponding Android System service.

It is the same as calling the Context.getSystemService() method.

Usage example:

@EActivity
public class MyActivity extends Activity {

  @SystemService
  NotificationManager notificationManager;

}