rasheedk / react-native-disable-battery-optimizations-android

A react native library for checking battery optimization and whitelisting in Android
29 stars 46 forks source link

null is not an object (evaluating '_reactNativeDisableBatteryOptimizationsAndroid.default.enableBackgroundServicesDialogue') #1

Open emersonrf227 opened 4 years ago

emersonrf227 commented 4 years ago

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);
}`
bl4val commented 4 years ago

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)