seididieci / capacitor-backround-geolocation

Ionic capacitor backgroung geolocation Plugin
MIT License
12 stars 2 forks source link

Error HIGH_ACCURACY of undefined #1

Closed 2bona closed 4 years ago

2bona commented 4 years ago

After installing it on capacitor + vuejs, following the basic steps and updating the MainActivity, the android emulator gives this error

09-21 20:23:48.506 11267-11267/com.edeyapp.delivery E/AndroidRuntime: FATAL EXCEPTION: main Process: com.edeyapp.delivery, PID: 11267 java.lang.RuntimeException: Unable to start service com.getcapacitor.community.bglocation.LocationUpdatesService@34128a7 with Intent { act=com.getcapacitor.community.bglocation.goforeground cmp=com.edeyapp.delivery/com.getcapacitor.community.bglocation.LocationUpdatesService VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }: java.lang.NullPointerException: println needs a message at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4079) at android.app.ActivityThread.access$2400(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1897) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.NullPointerException: println needs a message at android.util.Log.println_native(Native Method) at android.util.Log.w(Log.java:250) at com.getcapacitor.community.bglocation.LocationUpdatesService.getNotification(LocationUpdatesService.java:242) at com.getcapacitor.community.bglocation.LocationUpdatesService.onStartCommand(LocationUpdatesService.java:122) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4062) at android.app.ActivityThread.access$2400(ActivityThread.java:221)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1897)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:158)  at android.app.ActivityThread.main(ActivityThread.java:7224)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 

Please can you tell me what i am doing wrong.

2bona commented 4 years ago

it stopped showing the error when I did this

requestedAccuracy: BackgroundGeolocation.HIGH_ACCURACY,

instead of requestedAccuracy: BgGeolocationAccuracy.HIGH_ACCURACY,

seididieci commented 4 years ago

Hi 2bona, I'm glad you solved your Issue but I think the solution is a bit strange: if I try your solution in Typescript it will not compile. From the exception you posted the problem seemed to be in the plugin not able to create the notification "tap" intent based on the main activity class name. Then it crashes on trying to log a localized message for the exception thrown by intent class constructor... I will try to fix that crash, but I have a working application using requestedAccuracy: BgGeolocationAccuracy.HIGH_ACCURACY May the problem be somewhere else?