Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

ERROR: Attempt to invoke virtual method void... #394

Open
2 of 4 tasks
futureinapps opened this issue Aug 14, 2021 · 3 comments
Open
2 of 4 tasks

ERROR: Attempt to invoke virtual method void... #394

futureinapps opened this issue Aug 14, 2021 · 3 comments

Comments

@futureinapps
Copy link

futureinapps commented Aug 14, 2021

iOS works perfectly, on Android i have an error:

"Attempt to invoke virtual method void com.tanguyantoine.react.MusicControlAudioFocusListener.requestAudioFocus() on a null object reference"

  1. Sample code (provide repo url or sample code)
componentDidMount(){
    RNMS.enableBackgroundMode(true);
    RNMS.handleAudioInterruptions(true);
    RNMS.enableControl('play', true);
    RNMS.enableControl('pause', false);
    RNMS.on(Command.play, () => {
      start();
    });
    RNMS.on(Command.pause, () => {
      pause();
    });
}

if I comment RNMS.handleAudioInterruptions(true); it works perfectly, but crashes on this:

RNMS.setNowPlaying({
title: 'title',
artist: 'artist',
genre: 'genre',
// });
  1. Platform ?

    • iOS
    • Android
  1. Device
  • Simulator
  • Real device
@cjhines
Copy link

cjhines commented Sep 29, 2021

Setting handleAudioInterruptions to false stopped this error for me.

Not ideal I know.

@Aleksandern
Copy link

I have the same issue.

@cjhines @futureinapps
Did you find any other solution except setting handleAudioInterruptions to false?

@cjhines
Copy link

cjhines commented Feb 17, 2022

@Aleksandern

I'm afraid I eventually ended up incorporating and modifying the native modules directly into my app.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants