@@ -33,15 +33,15 @@ context.registerBroadcast(new MyReceiver(), filter);
3333
3434### With Breadcast you can choose between 2 ways:
3535
36- #### Breadcast Standalone (Base package):
36+ ### 1. Breadcast Standalone (Base package)
3737``` java
3838new Breadcaster (context)
3939 .action(Intent . ACTION_SCREEN_OFF , (context, intent) - > ... )
4040 .action(Intent . ACTION_SCREEN_ON , (context, intent) - > ... )
4141 .register();
4242```
4343
44- #### Breadcast Annotation:
44+ ### 2. Breadcast Annotation
4545``` java
4646Breadcast . init(context);
4747```
@@ -53,22 +53,25 @@ class MyClass { // extends ...
5353
5454 @Receive (action = Intent . ACTION_SCREEN_OFF )
5555 void onScreenOff () { ... }
56+
57+ @Receive (action = Intent . ACTION_SCREEN_ON )
58+ void onScreenOff () { ... }
5659}
5760```
5861
59- ##### More examples
62+ #### More examples
6063``` java
61- @Receive (action = {Intent . ACTION_SCREEN_ON , Intent . ACTION_SCREEN_OFF }, threadMode = ThreadModus . ASYNC )
62- void onScreenChange(Context context, Intent intent) { ... } // multiple asynchronous
63-
64- @Receive (action = {" custom1" , " custom2" })
65- void onCustom() { ... }
64+ @Receive (action = {Intent . ACTION_SCREEN_ON , Intent . ACTION_SCREEN_OFF })
65+ onScreenChange(Context context, Intent intent) { ... } // multiple
6666
67- static void withoutRegister() { ... } // static - called once regardless of registration
68- ```
67+ @Receive ( action = { " custom1 " , " custom2 " }, threadMode = ThreadModus . ASYNC )
68+ onCustom() { ... } // asynchronous
6969
70+ @Receive (action = Intent . ACTION_SHUTDOWN )
71+ static withoutRegister() { ... } // static - called once regardless of registration
72+ ```
7073
71- ##### To register Breadcast by manifest, use _ ManifestBreadcast_ :
74+ #### To register Breadcast implicit via manifest, use _ ManifestBreadcast_
7275``` xml
7376<receiver android : name =" io.dreiklang.breadcast.base.statics.ManifestBreadcast" >
7477 <intent-filter >
@@ -77,22 +80,23 @@ class MyClass { // extends ...
7780</receiver >
7881```
7982```
80- ...
81- @Receive(action = Intent.ACTION_BOOT_COMPLETED)
82- static onBoot() { ... } // must be static
83+ @Receive(action = Intent.ACTION_BOOT_COMPLETED)
84+ static onBoot() { ... } // must be static
8385```
84-
86+ ## Notes
87+ - Standalone: Remember to call release() if not needed anymore (memory leaks)
88+ - Watch out for Android O's [ implicit broadcast exceptions] ( https://developer.android.com/guide/components/broadcast-exceptions.html )
8589
8690## Download
8791#### Gradle
8892``` java
8993dependencies {
9094 // required
91- implementation ' io.dreiklang:breadcast-base:1.0.1 '
95+ implementation ' io.dreiklang:breadcast-base:1.1.0 '
9296
9397 // if you use the annotation
94- implementation ' io.dreiklang:breadcast-annotation:1.0.1 '
95- annotationProcessor ' io.dreiklang:breadcast-processor:1.0.1 '
98+ implementation ' io.dreiklang:breadcast-annotation:1.1.0 '
99+ annotationProcessor ' io.dreiklang:breadcast-processor:1.1.0 '
96100}
97101```
98102
0 commit comments