react-native-disable-battery-optimizations-android
react-native-disable-battery-optimizations-android copied to clipboard
null is not an object (evaluating '_reactNativeDisableBatteryOptimizationsAndroid.default.enableBackgroundServicesDialogue')
Fiz a inclusão da biblioteca onde apresentou o seguinte erro null is not an object (evaluating '_reactNativeDisableBatteryOptimizationsAndroid.default.enableBackgroundServicesDialogue')
` componentDidMount() { RNDisableBatteryOptimizationsAndroid.enableBackgroundServicesDialogue(); this.getData(); Audio.setAudioModeAsync({ allowsRecordingIOS: false, interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, playsInSilentModeIOS: true, interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, shouldDuckAndroid: true, staysActiveInBackground: true, playThroughEarpieceAndroid: false, playsInBackgroundModeIOS: true, playsInBackgroundModeAndroid: true
});
this.consultaMusica();
this._interval = setInterval(() => {
this.consultaMusica()
}, 5000);
}`
You need to rebuild the application
npx react-native start
to run the metro bundler
npx react-native run-android
to rebuild the android application (and start it on the phone)