React-native-track-player: [Android] Crash - android.app.RemoteServiceException

Created on 8 Jun 2019  路  13Comments  路  Source: react-native-kit/react-native-track-player

i am getting crash logs on playstore for some of the devices:

android.app.RemoteServiceException: 
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1872)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7045)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)

i tested on some of the devices it's working properly. i updated react native track player and target sdk version to 28. any idea why this crash happening ?

i am attaching Android versions and devices info on which crashes happens:

Screen Shot 2019-06-08 at 8 21 09 PM

Android

Most helpful comment

this issue still occur on latest version 1.2.3
please help us fix it.

All 13 comments

I have the same exception. Most of devices are Galaxies:

image

Can you share the code you're using on updateOptions?

Hi @Guichaguri -- seeing this issue crop up for my users as well. Here's what's being passed to updateOptions:

export const playerOptions = {
    maxArtworkSize: 500,
    capabilities: [
        TrackPlayer.CAPABILITY_PLAY,
        TrackPlayer.CAPABILITY_PAUSE,
        TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
        TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
        TrackPlayer.CAPABILITY_STOP,
    ],
    compactCapabilities: [
        TrackPlayer.CAPABILITY_PLAY,
        TrackPlayer.CAPABILITY_PAUSE,
        TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
        TrackPlayer.CAPABILITY_STOP,
    ],
}

@Guichaguri My initial options:

await TrackPlayer.updateOptions({
    stopWithApp: true
});

Then I change capabilities when current track changes by calling updateOptions:

const updateOptions = async () => {
  const capabilities = getCapabilities();

  await TrackPlayer.updateOptions({
    capabilities
  });
};

const getCapabilities = () => {
  const result = [TrackPlayer.CAPABILITY_PLAY, TrackPlayer.CAPABILITY_PAUSE];

  const { prev, next } = store.getState().player.queueButtons;

  if (prev) {
    result.push(TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS);
  }

  if (next) {
    result.push(TrackPlayer.CAPABILITY_SKIP_TO_NEXT);
  }

  return result;
};

Any updates on this ?

Any update ++?

  • same error any fix ?

here is my logs

Fatal Exception: android.app.RemoteServiceException
Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{dab92ee u0 com.indiacharts/com.guichaguri.trackplayer.service.MusicService}
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1738)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:193)
android.app.ActivityThread.main (ActivityThread.java:6692)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)

any update?? still this error happens...

I'm having similar issues. Any updates?

I am also having this issue but can't seem to replicate it. Any fixes available?

this issue still occur on latest version 1.2.3
please help us fix it.

Same issue

Happens to us as well. @Guichaguri here are the options:

```
await TrackPlayer.updateOptions({
stopWithApp: true,
capabilities: [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
TrackPlayer.CAPABILITY_JUMP_FORWARD,
TrackPlayer.CAPABILITY_JUMP_FORWARD,
TrackPlayer.CAPABILITY_JUMP_BACKWARD,
],
compactCapabilities: [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_JUMP_FORWARD,
TrackPlayer.CAPABILITY_JUMP_BACKWARD,
],
notificationCapabilities: [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_JUMP_FORWARD,
TrackPlayer.CAPABILITY_JUMP_BACKWARD,
],
jumpInterval: 15,
icon: PLAYER_IMAGE,
color: 0x157595,
});

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sagargheewala picture sagargheewala  路  3Comments

KalebPortillo picture KalebPortillo  路  4Comments

amed picture amed  路  4Comments

toooldmohammad picture toooldmohammad  路  3Comments

moduval picture moduval  路  4Comments