react-native-track-player: APP crashing when device loses internet connection [Android]

Hi All,

This is happening on a real device, when the device loses internet connect, then recover it crashes the app. fabric.io is showing these logs

MusicModule.java line 102 com.guichaguri.trackplayer.module.MusicModule.waitForConnection

Fatal Exception: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=/com.guichaguri.trackplayer.service.MusicService }: app is in background uid UidRecord{4df9b02 u0a156 CAC bg:+1m6s332ms idle change:cached procs:1 seq(0,0,0)} at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1522) at android.app.ContextImpl.startService(ContextImpl.java:1478) at android.content.ContextWrapper.startService(ContextWrapper.java:650) at android.content.ContextWrapper.startService(ContextWrapper.java:650) at com.guichaguri.trackplayer.module.MusicModule.waitForConnection(MusicModule.java:102) at com.guichaguri.trackplayer.module.MusicModule.stop(MusicModule.java:322) at java.lang.reflect.Method.invoke(Method.java) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) at android.os.Looper.loop(Looper.java:164) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232) at java.lang.Thread.run(Thread.java:764)

version: 1.1.4

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@Guichaguri @curiousdustin I’m also experiencing this crash

I’ve deployed an app using this library and have around 500 users now, and this crash is my top Crashlytics report right now (about 10-20 reports so far). although upgrading React-Native to 0.60+ reduced number of reports considerably. Unfortunately since my users does not have any significance computer knowledge it’s hard to asses why this happens and get a decent scenario from them.