forked from androidannotations/androidannotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance services
Pierre-Yves Ricau edited this page Feb 2, 2012
·
10 revisions
Since AndroidAnnotations 2.4
You can enhance an Android Service with the @EService annotation:
@EService
public class MyService extends Service {
}You can then start using most AA annotations, except the ones related to views and extras:
@EService
public class MyService extends IntentService {
@SystemService
NotificationManager notificationManager;
@Bean
MyEnhancedDatastore datastore;
@RestService
MyService myService;
public MyService() {
super(MyService.class.getSimpleName());
}
@Override
protected void onHandleIntent(Intent intent) {
// Do some stuff...
showToast();
}
@UiThread
void showToast() {
Toast.makeText(getApplicationContext(), "Hello World!", Toast.LENGTH_LONG).show();
}
}AndroidAnnotations was created by Pierre-Yves Ricau and is sponsored by eBusinessInformations.
04/11/2012 The 2.7 release is out
- Get started!
- Download
- Cookbook, full of recipes
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow