|
@@ -136,8 +136,6 @@ class AudioModeModule extends ReactContextBaseJavaModule {
|
136
|
136
|
*/
|
137
|
137
|
public AudioModeModule(ReactApplicationContext reactContext) {
|
138
|
138
|
super(reactContext);
|
139
|
|
-
|
140
|
|
- setAudioDeviceHandler();
|
141
|
139
|
}
|
142
|
140
|
|
143
|
141
|
/**
|
|
@@ -193,6 +191,16 @@ class AudioModeModule extends ReactContextBaseJavaModule {
|
193
|
191
|
return NAME;
|
194
|
192
|
}
|
195
|
193
|
|
|
194
|
+ /**
|
|
195
|
+ * Initializes the audio device handler module. This function is called *after* all Catalyst
|
|
196
|
+ * modules have been created, and that's why we use it, because {@link AudioDeviceHandlerConnectionService}
|
|
197
|
+ * needs access to another Catalyst module, so doing this in the constructor would be too early.
|
|
198
|
+ */
|
|
199
|
+ @Override
|
|
200
|
+ public void initialize() {
|
|
201
|
+ setAudioDeviceHandler();
|
|
202
|
+ }
|
|
203
|
+
|
196
|
204
|
private void setAudioDeviceHandler() {
|
197
|
205
|
if (audioDeviceHandler != null) {
|
198
|
206
|
audioDeviceHandler.stop();
|