Richou / react-native-android-location-enabler

Display a GoogleMap like android popup to ask for user to enable location services if disabled
MIT License
209 stars 52 forks source link

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 #51

Open mkraina opened 4 years ago

mkraina commented 4 years ago

Hi, received this error

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

com.google.android.gms.common.api.Status in startResolutionForResult at line 17 com.google.android.gms.common.api.ResolvableApiException in startResolutionForResult at line 3 com.heanoria.library.reactnative.locationenabler.RNAndroidLocationEnablerModule in onComplete at line 120 com.google.android.gms.tasks.zzi in run at line 4 android.os.Handler in handleCallback at line 883 android.os.Handler in dispatchMessage at line 100 com.google.android.gms.internal.tasks.zzb in dispatchMessage at line 6 android.os.Looper in loop at line 237 android.app.ActivityThread in main at line 8167 java.lang.reflect.Method in invoke com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 496 com.android.internal.os.ZygoteInit in main at line 1100

RNAndroidLocationEnablerModule l.120: resolvable.startResolutionForResult(getCurrentActivity(), REQUEST_CHECK_SETTINGS); is wrapped by trycatch, any idea why this is not handled here?

android versions affected: 9, 10

Rose-mary-abraham commented 3 years ago

Fatal 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.api.Status.startResolutionForResult(com.google.android.gms:play-services-basement@@17.2.1:17) at com.google.android.gms.common.api.ResolvableApiException.startResolutionForResult(com.google.android.gms:play-services-basement@@17.2.1:3) at com.heanoria.library.reactnative.locationenabler.RNAndroidLocationEnablerModule.onComplete(RNAndroidLocationEnablerModule.java:120) at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@17.0.2:4) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at com.google.android.gms.internal.tasks.zzb.dispatchMessage(com.google.android.gms:play-services-tasks@@17.0.2:6) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6644) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

   Received the same crash in firebase crashlytics.
   Device
   Brand: SHARP
   Model: AQUOS U SHV37

   Operating System
   Version: 8.0.0

   Library version: 1.2.1
ramakala-copart commented 3 months ago

I am still facing this issue. Any work around?