React-native-track-player: [android] No task registered for key TrackPlayer, stack: startHeadlessTask

Created on 6 Dec 2019  路  5Comments  路  Source: react-native-kit/react-native-track-player

Configuration

Run react-native info in your project and share the content.
What react-native-track-player version are you using?

Issue

Production app tracking crashes like this, but I can't simulation. because It's occurs somethimes at some users.

My firebase crash like this for 5% of my user.

釀夅叧釀忈叧釀呩叺釂剦釁a喓 2019-12-06 釀嬦叐釀掅叜 2 24 15

Code

Show us the code you are using

Android Question

Most helpful comment

My solution is add service in index.js file

import { AppRegistry } from 'react-native';
import TrackPlayer from 'react-native-track-player';

import App from './App';
AppRegistry.registerComponent('example', () => App);
TrackPlayer.registerPlaybackService(() => require('./service'));

and file service you could find in example project

All 5 comments

My solution is add service in index.js file

import { AppRegistry } from 'react-native';
import TrackPlayer from 'react-native-track-player';

import App from './App';
AppRegistry.registerComponent('example', () => App);
TrackPlayer.registerPlaybackService(() => require('./service'));

and file service you could find in example project

@Saehanseul can you send the part of the code where you register the service?

@Guichaguri I'm using mobx and made trackplayerStore. So using Trackplayer.registerPlaybackService in constructor of trackplayerStore.

like this.
釀夅叧釀忈叧釀呩叺釂剦釁a喓 2019-12-27 釀嬦叐釀掅叜 1 17 13

You have to make sure you're registering it in the initialization file, you can't depend on any component to be mounted. We highly recommend registering it right after registering the main component for your app, so no component has to be loaded in order to register the playback service.

Thanks. I'll try it and check the firebase user bug after that:)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amed picture amed  路  4Comments

moduval picture moduval  路  4Comments

toooldmohammad picture toooldmohammad  路  3Comments

moduval picture moduval  路  4Comments

fabiocosta88 picture fabiocosta88  路  3Comments