File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -95,14 +95,14 @@ To declare a required dependency use the following in your `ComponentRegistrar`:
95
95
96
96
The provider will return ` null ` if the dependency is not present in the app.
97
97
98
- {: warning }
98
+ {: . warning }
99
99
When the app uses [ Play's dynamic feature delivery] ( https://developer.android.com/guide/playcore/feature-delivery ) ,
100
100
` provider.get() ` can return your dependency when it becomes available, so be prepared for that.
101
101
And don't store references to the result of ` provider.get() ` calls.
102
102
103
103
See [ Dynamic Module Support] ({{ site.baseurl }}{% link components/dynamic_modules.md %}) for details
104
104
105
- {: warning }
105
+ {: . warning }
106
106
See Deferred dependencies if you your dependency has a callback based apis
107
107
108
108
## Deferred Dependencies
@@ -166,7 +166,7 @@ To consume such a set the interested `Component` needs to declare a special kind
166
166
is that the ` Set ` is not initialized until the first call to ` provider.get() ` at which point all elements of the
167
167
set will get initialized.
168
168
169
- {: warning }
169
+ {: . warning }
170
170
Similar to optional ` Provider ` dependencies, where an optional dependency can become available at runtime due to
171
171
[ Play's dynamic feature delivery] ( https://developer.android.com/guide/playcore/feature-delivery ) ,
172
172
` Set ` dependencies can change at runtime by new elements getting added to the set.
Original file line number Diff line number Diff line change @@ -188,7 +188,8 @@ For Kotlin
188
188
class FirebaseFooRegistrar : ComponentRegistrar {
189
189
override fun getComponents () =
190
190
listOf (
191
- Component .builder(FirebaseFoo ::class .java).factory { container -> FirebaseFoo () }.build()
191
+ Component .builder(FirebaseFoo ::class .java).factory { container -> FirebaseFoo () }.build(),
192
+ LibraryVersionComponent .create(" fire-foo" , BuildConfig .VERSION_NAME )
192
193
)
193
194
}
194
195
```
@@ -205,8 +206,10 @@ For Java
205
206
public class FirebaseFooRegistrar implements ComponentRegistrar {
206
207
@Override
207
208
public List<Component<?> > getComponents () {
208
- return Collections . singletonList(
209
- Component . builder(FirebaseFoo . class). factory(c - > new FirebaseFoo ()). build());
209
+ return Arrays . asList(
210
+ Component . builder(FirebaseFoo . class). factory(c - > new FirebaseFoo ()). build(),
211
+ LibraryVersionComponent . create(" fire-foo" , BuildConfig . VERSION_NAME ));
212
+
210
213
}
211
214
}
212
215
```
You can’t perform that action at this time.
0 commit comments