StasDoskalenko / react-native-google-fit

A React Native bridge module for interacting with Google Fit
MIT License
338 stars 209 forks source link

Running the react-native google fit with background fetch crashes the app #329

Open wojtas56 opened 2 years ago

wojtas56 commented 2 years ago

Hi, when react-native-google-fit is running in the background using the background fetch feature the app crashes after some time (when terminated or in the background). I am also using headless task. This is the error report I get:

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int)' on a null object reference
  at com.google.android.gms.common.ConnectionResult.startResolutionForResult (com.google.android.gms:play-services-basement@@18.0.0:2)
  at com.reactnative.googlefit.GoogleFitManager$1.onConnectionFailed (GoogleFitManager.java:189)
  at com.google.android.gms.common.internal.zak.zac (com.google.android.gms:play-services-base@@18.0.1:8)
  at com.google.android.gms.common.api.internal.zabe.zaa (com.google.android.gms:play-services-base@@18.0.1:3)
  at com.google.android.gms.common.api.internal.zaaw.zaD (com.google.android.gms:play-services-base@@18.0.1:4)
  at com.google.android.gms.common.api.internal.zaaw.zar (com.google.android.gms:play-services-base@@18.0.1:16)
  at com.google.android.gms.common.api.internal.zaaq.zaa (com.google.android.gms:play-services-base@@18.0.1:1)
  at com.google.android.gms.common.api.internal.zabg.zab (com.google.android.gms:play-services-base@@18.0.1:4)
  at com.google.android.gms.common.api.internal.zabh.handleMessage (com.google.android.gms:play-services-base@@18.0.1:4)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:223)
  at android.app.ActivityThread.main (ActivityThread.java:7656)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)

Any thoughts on this? Thanks.

RN version: 0.65.1 react-native-google-fit: 0.18.3

Krupal5691 commented 8 months ago

@wojtas56 Did you resolved the issue? I am also getting the same issue.

@marcusds @jacquerie @ksetrin @kristerkari