transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
649 stars 240 forks source link

Uncaught Exception: Invalid latitude: -114.05992704473897 #825

Closed tegaologe closed 1 year ago

tegaologe commented 2 years ago

Version 4.7.2 Android version 9 Samsung

Config bg.BackgroundGeolocation.ready(bg.Config( desiredAccuracy: bg.Config.DESIRED_ACCURACY_NAVIGATION, distanceFilter: 100.0, stopOnTerminate: true, startOnBoot: true, enableHeadless: true, debug: true, heartbeatInterval: 60, backgroundPermissionRationale: bg.PermissionRationale( title: "Allow {applicationName} to access this device's location even when the app is closed or not in use.", message: "This app collects location data to enable recording your trips to work and calculate distance-travelled.", positiveAction: 'Change to "{backgroundPermissionOptionLabel}"', negativeAction: 'Cancel'), logLevel: bg.Config.LOG_LEVEL_VERBOSE))

Everytime geolocation background it will crash with this error E/TSLocationManager(11749): [c.t.l.a.BackgroundGeolocation$w0 uncaughtException] E/TSLocationManager(11749): ‼️ Uncaught Exception: Invalid latitude: -114.05992704473897

only on android

christocracy commented 2 years ago

That’s right. Valid latitude are in the range +90 to -90.

How do you manage to get a device to provide an invalid latitude to the plugin?

tegaologe commented 2 years ago

I have no idea how, that is what the plugin is receiving. it crashes every-time i start the background location

christocracy commented 2 years ago

I’ve never heard of this before. There are thousands of people using this plugin.

Show me a full logcat of your app booting:

$ adb logcat *:S TSLocationManager:V
christocracy commented 2 years ago

I suggest you try a different device, as well.

tegaologe commented 2 years ago

I suggest you try a different device, as well.

i have tried different phone with same issue.

tegaologe commented 2 years ago

D/TSLocationManager(17597): [c.t.locationmanager.util.c g] D/TSLocationManager(17597): ℹ️ LocationAuthorization: Permission granted I/TSLocationManager(17597): - Enable: false → true, trackingMode: 1 I/TSLocationManager(17597): [c.t.l.data.sqlite.GeofenceDAO destroy] I/TSLocationManager(17597): ✅ pickup I/TSLocationManager(17597): [c.t.l.data.sqlite.GeofenceDAO create] I/TSLocationManager(17597): ✅ pickup I/TSLocationManager(17597): [c.t.l.data.sqlite.GeofenceDAO destroy] I/TSLocationManager(17597): ✅ delivery I/TSLocationManager(17597): [c.t.l.data.sqlite.GeofenceDAO create] I/TSLocationManager(17597): ✅ delivery I/amplify:aws-datastore(17597): Orchestrator lock acquired. D/TSLocationManager(17597): [c.t.l.g.TSGeofenceManager d] ℹ️ Persist monitored geofences: [] I/amplify:aws-datastore(17597): Orchestrator lock released. D/TSLocationManager(17597): [c.t.l.http.HttpService startMonitoringConnectivityChanges] D/TSLocationManager(17597): 🎾 Start monitoring connectivity changes D/ConnectivityManager(17597): requestNetwork; CallingUid : 10408, CallingPid : 17597 D/TSLocationManager(17597): [c.t.l.device.DeviceSettings startMonitoringPowerSaveChanges] D/TSLocationManager(17597): 🎾 Start monitoring powersave changes W/Settings(17597): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value. I/TSLocationManager(17597): [c.t.l.service.HeartbeatService start] I/TSLocationManager(17597): 🎾 Start heartbeat (60s) D/TSLocationManager(17597): [c.t.l.http.HttpService a] D/TSLocationManager(17597): ╔═════════════════════════════════════════════ D/TSLocationManager(17597): ║ 📶 Connectivity change: connected? true D/TSLocationManager(17597): ╠═════════════════════════════════════════════ D/TSLocationManager(17597): [c.t.locationmanager.util.c h] D/TSLocationManager(17597): ℹ️ LocationAuthorization: Permission granted I/TSLocationManager(17597): [c.t.l.service.TrackingService changePace] I/TSLocationManager(17597): 🔵 setPace: false → false D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 LocationRequestService [eventCount: 1] I/TSLocationManager(17597): [c.t.l.l.SingleLocationRequest startUpdatingLocation] I/TSLocationManager(17597): 🔵 [SingleLocationRequest start, action: 1, requestId: 1] I/amplify:aws-datastore(17597): Orchestrator lock acquired. D/AutoSessionTracker(17597): Activity paused: MainActivity I/amplify:aws-datastore(17597): Orchestrator lock released. I/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService start] I/TSLocationManager(17597): 🎾 Start motion-activity updates D/TSLocationManager(17597): [c.t.l.g.TSGeofenceManager$e run] evaluation buffer timer elapsed W/ActivityThread(17597): handleWindowVisibility: no activity for token android.os.BinderProxy@5455c58 D/ViewRootImpl@1a329MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 1 D/InputMethodManager(17597): prepareNavigationBarInfo() DecorView@e98bf0[MainActivity] D/InputMethodManager(17597): getNavigationBarColor() -855310 E/TSLocationManager(17597): [c.t.l.l.TSLocationManager getLastLocation] E/TSLocationManager(17597): ‼️ Failed to get last location: com.google.android.gms.tasks.zzw@68be696 D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: true] W/m.laprairie.lm(17597): Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking) W/m.laprairie.lm(17597): Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking) W/m.laprairie.lm(17597): Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking) W/m.laprairie.lm(17597): Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking) D/AutoSessionTracker(17597): Activity created: com.transistorsoft.locationmanager.activity.TSLocationManagerActivity D/TSLocationManager(17597): [c.t.l.a.TSLocationManagerActivity execute] locationsettings D/TSLocationManager(17597): [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -2 I/DecorView(17597): createDecorCaptionView >> DecorView@d36165d[], isFloating: true, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true D/AutoSessionTracker(17597): Activity started: com.transistorsoft.locationmanager.activity.TSLocationManagerActivity W/m.laprairie.lm(17597): Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection) W/m.laprairie.lm(17597): Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection) D/AutoSessionTracker(17597): Activity resumed: com.transistorsoft.locationmanager.activity.TSLocationManagerActivity D/InputTransport(17597): Input channel constructed: fd=137 D/ViewRootImpl@1d2d4d0TSLocationManagerActivity: setView = DecorView@d36165d[TSLocationManagerActivity] TM=true MM=false D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 ActivityRecognitionService [eventCount: 1] D/TSLocationManager(17597): [c.t.l.a.TSLocationManagerActivity stop] eventCount: 0 D/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService handleActivityRecognitionResult] D/TSLocationManager(17597): 🚘 ️DetectedActivity [type=STILL, confidence=100] D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] D/ViewRootImpl@1d2d4d0TSLocationManagerActivity: Relayout returned: old=[0,72][1080,2175] new=[540,1123][540,1123] result=0x7 surface={true 525227577344} changed=true D/mali_winsys(17597): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/OpenGLRenderer(17597): eglCreateWindowSurface = 0x7a3577a580, 0x7a4a00d010 D/ViewRootImpl@1a329MainActivity: MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(17597): prepareNavigationBarInfo() DecorView@e98bf0[MainActivity] D/InputMethodManager(17597): getNavigationBarColor() -855310 D/AutoSessionTracker(17597): Activity paused: com.transistorsoft.locationmanager.activity.TSLocationManagerActivity D/ViewRootImpl@1d2d4d0TSLocationManagerActivity: stopped(true) old=false I/TSLocationManager(17597): [c.t.l.s.TSScheduleManager oneShot] I/TSLocationManager(17597): ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588) D/AutoSessionTracker(17597): Activity stopped: com.transistorsoft.locationmanager.activity.TSLocationManagerActivity D/AutoSessionTracker(17597): Activity destroyed com.transistorsoft.locationmanager.activity.TSLocationManagerActivity D/TSLocationManager(17597): [c.t.l.a.TSLocationManagerActivity onDestroy] W/libEGL (17597): EGLNativeWindowType 0x7a4a00d010 disconnect failed D/OpenGLRenderer(17597): eglDestroySurface = 0x7a3577a580, 0x7a4a00d000 D/ViewRootImpl@1d2d4d0TSLocationManagerActivity: dispatchDetachedFromWindow D/InputTransport(17597): Input channel destroyed: fd=137 D/ViewRootImpl@1a329MainActivity: stopped(false) old=false I/TSLocationManager(17597): [c.t.l.s.TSScheduleManager cancelOneShot] I/TSLocationManager(17597): ⏰ Cancel OneShot: TERMINATE_EVENT D/AutoSessionTracker(17597): Activity resumed: MainActivity W/System.err(17597): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference W/System.err(17597): at android.view.ViewRootImpl.getHostVisibility(ViewRootImpl.java:1806) W/System.err(17597): at android.view.ViewRootImpl.handleAppVisibility(ViewRootImpl.java:1442) W/System.err(17597): at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4838) W/System.err(17597): at android.os.Handler.dispatchMessage(Handler.java:106) W/System.err(17597): at android.os.Looper.loop(Looper.java:214) W/System.err(17597): at android.app.ActivityThread.main(ActivityThread.java:7078) W/System.err(17597): at java.lang.reflect.Method.invoke(Native Method) W/System.err(17597): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) W/System.err(17597): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) D/ViewRootImpl@1a329MainActivity: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={true 525227515904} changed=false D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 ActivityRecognitionService [eventCount: 1] D/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService handleActivityTransitionResult] ** wasMoving: false, nowMoving: true, startedMoving: true, justStopped; false I/amplify:aws-datastore(17597): Orchestrator lock acquired. D/TSLocationManager(17597): [c.t.l.adapter.TSConfig d] ℹ️ Persist config, dirty: [isMoving] I/amplify:aws-datastore(17597): Orchestrator lock released. I/TSLocationManager(17597): [c.t.l.service.HeartbeatService stop] I/TSLocationManager(17597): 🔴 Stop heartbeat D/TSLocationManager(17597): [c.t.locationmanager.util.c h] D/TSLocationManager(17597): ℹ️ LocationAuthorization: Permission granted I/TSLocationManager(17597): [c.t.l.service.TrackingService changePace] I/TSLocationManager(17597): 🔵 setPace: false → true I/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService handleActivityTransitionResult] I/TSLocationManager(17597): ╔═════════════════════════════════════════════ I/TSLocationManager(17597): ║ Motion Transition Result I/TSLocationManager(17597): ╠═════════════════════════════════════════════ I/TSLocationManager(17597): ╟─ 🎾 ENTER: in_vehicle I/TSLocationManager(17597): ╚═════════════════════════════════════════════ D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 TrackingService [eventCount: 1] I/amplify:flutter:datastore(17597): Saved item: SerializedModel{id='03ea42ea-b0a4-4931-8225-f044daa2bcbc', serializedData={sel_location=null, equiptype_id=null, available=false, createdAt=null, user_role=["754c81f0-9d9a-49cf-ac88-a5e917bc544d"], trailer01_id=null, sel_company=null, id=03ea42ea-b0a4-4931-8225-f044daa2bcbc, trailer01_name=null, truck_name=Pickup01, email=null, updatedAt=null, truck_id=b994d6d3-2b02-46d9-8177-92da6bf84883, company_id=43bb1480-0253-4d87-bc1d-60443973fcc5, equiptype_name=null, given_name=sample, token=dNbMa3EyRBmCAZ3ygpoQla:APA91bFLZg_aKg0CmxbuY5noO9Au3taRDskvsOZnd_OkmCOvOm2bI9GRVXUZzB2ezf28yfnPVsW8DAkAaT4K9zphmXsyf6Y9SvWaIMvYw5qsS2OPJJDrGQdC-CKnwiQpQo-L5K0yK9Wk, trailer02_id=null, driver=false, user_id=a3bc401d-0e8b-453c-9fb1-e9819dff6414, trailer02_name=null, phone_number=+14036128224, family_name=sample, username=sample}, modelName=Users} I/TSLocationManager(17597): [c.t.l.service.TrackingService handleMotionChangeResult] I/TSLocationManager(17597): ╔═════════════════════════════════════════════ I/TSLocationManager(17597): ║ TrackingService motionchange: true I/TSLocationManager(17597): ╠═════════════════════════════════════════════ D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish TrackingService [eventCount: 0, sticky: true] D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] D/TSLocationManager(17597): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(17597): 🔴 LocationRequestService stopped D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 LocationRequestService [eventCount: 1] I/TSLocationManager(17597): [c.t.l.l.SingleLocationRequest startUpdatingLocation] I/TSLocationManager(17597): 🔵 [SingleLocationRequest start, action: 1, requestId: 2] I/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService start] I/TSLocationManager(17597): 🎾 Start motion-activity updates I/amplify:aws-datastore(17597): Orchestrator lock acquired. D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: true] I/amplify:aws-datastore(17597): Orchestrator lock released. D/TSLocationManager(17597): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(17597): 🔴 ActivityRecognitionService stopped I/amplify:aws-datastore(17597): Successfully removed from mutations outboxPendingMutation{mutatedItem=SerializedModel{id='03ea42ea-b0a4-4931-8225-f044daa2bcbc', serializedData={sel_location=null, equiptype_id=null, available=false, createdAt=null, user_role=["754c81f0-9d9a-49cf-ac88-a5e917bc544d"], trailer01_id=null, sel_company=null, id=03ea42ea-b0a4-4931-8225-f044daa2bcbc, trailer01_name=null, truck_name=Pickup01, email=null, updatedAt=null, truck_id=b994d6d3-2b02-46d9-8177-92da6bf84883, company_id=43bb1480-0253-4d87-bc1d-60443973fcc5, equiptype_name=null, given_name=sample, token=dNbMa3EyRBmCAZ3ygpoQla:APA91bFLZg_aKg0CmxbuY5noO9Au3taRDskvsOZnd_OkmCOvOm2bI9GRVXUZzB2ezf28yfnPVsW8DAkAaT4K9zphmXsyf6Y9SvWaIMvYw5qsS2OPJJDrGQdC-CKnwiQpQo-L5K0yK9Wk, trailer02_id=null, driver=false, user_id=a3bc401d-0e8b-453c-9fb1-e9819dff6414, trailer02_name=null, phone_number=+14036128224, family_name=sample, username=sample}, modelName=Users}, mutationType=UPDATE, mutationId=939fd4eb-33c6-11ed-bb75-23535b068c9c, predicate=MatchAllQueryPredicate} I/m.laprairie.lm(17597): Background concurrent copying GC freed 104889(8MB) AllocSpace objects, 10(356KB) LOS objects, 49% free, 7MB/15MB, paused 7.011ms total 235.403ms I/amplify:aws-datastore(17597): Successfully enqueued PendingMutation{mutatedItem=SerializedModel{id='03ea42ea-b0a4-4931-8225-f044daa2bcbc', serializedData={sel_location=null, equiptype_id=null, available=false, createdAt=null, user_role=["754c81f0-9d9a-49cf-ac88-a5e917bc544d"], trailer01_id=null, sel_company=null, id=03ea42ea-b0a4-4931-8225-f044daa2bcbc, trailer01_name=null, truck_name=Pickup01, email=null, updatedAt=null, truck_id=b994d6d3-2b02-46d9-8177-92da6bf84883, company_id=43bb1480-0253-4d87-bc1d-60443973fcc5, equiptype_name=null, given_name=sample, token=dNbMa3EyRBmCAZ3ygpoQla:APA91bFLZg_aKg0CmxbuY5noO9Au3taRDskvsOZnd_OkmCOvOm2bI9GRVXUZzB2ezf28yfnPVsW8DAkAaT4K9zphmXsyf6Y9SvWaIMvYw5qsS2OPJJDrGQdC-CKnwiQpQo-L5K0yK9Wk, trailer02_id=null, driver=false, user_id=a3bc401d-0e8b-453c-9fb1-e9819dff6414, trailer02_name=null, phone_number=+14036128224, family_name=sample, username=sample}, modelName=Users}, mutationType=UPDATE, mutationId=0ccfc078-33cc-11ed-9c87-574e08401442, predicate=MatchAllQueryPredicate} D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 ActivityRecognitionService [eventCount: 1] D/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService handleActivityRecognitionResult] D/TSLocationManager(17597): 🚘 ️DetectedActivity [type=STILL, confidence=100] D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] I/amplify:aws-datastore(17597): Orchestrator lock acquired. I/amplify:aws-datastore(17597): Orchestrator lock released. D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 ActivityRecognitionService [eventCount: 1] D/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService handleActivityTransitionResult] wasMoving: true, nowMoving: true, startedMoving: false, justStopped; false I/TSLocationManager(17597): [c.t.l.s.ActivityRecognitionService handleActivityTransitionResult] I/TSLocationManager(17597): ╔═════════════════════════════════════════════ I/TSLocationManager(17597): ║ Motion Transition Result I/TSLocationManager(17597): ╠═════════════════════════════════════════════ I/TSLocationManager(17597): ╟─ 🎾 ENTER: in_vehicle I/TSLocationManager(17597): ╚═════════════════════════════════════════════ D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] D/TSLocationManager(17597): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(17597): 🔴 ActivityRecognitionService stopped D/ViewRootImpl@1a329MainActivity: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={true 525227515904} changed=false I/amplify:aws-datastore(17597): Orchestrator lock acquired. I/amplify:aws-datastore(17597): Orchestrator lock released. I/amplify:aws-datastore(17597): Orchestrator lock acquired. I/amplify:aws-datastore(17597): Orchestrator lock released. I/amplify:aws-datastore(17597): Orchestrator lock acquired. I/amplify:aws-datastore(17597): Orchestrator lock released. I/amplify:aws-datastore(17597): Orchestrator lock acquired. I/amplify:aws-datastore(17597): Orchestrator lock released. I/amplify:aws-datastore(17597): Orchestrator lock acquired. I/amplify:aws-datastore(17597): Orchestrator lock released. I/amplify:aws-datastore(17597): Orchestrator lock acquired. I/amplify:aws-datastore(17597): Orchestrator lock released. I/amplify:flutter:datastore(17597): Saved item: SerializedModel{id='b4644b7c-7aaf-4aaa-b3a1-fbec1124949b', serializedData={eq_type_name=, pickup_enable=false, pickup_name=, eq_type_id=, user_position={"lat":51.051929,"lng":-114.1688657}, travel_time_enable=false, travel_time=1.0, userID=a3bc401d-0e8b-453c-9fb1-e9819dff6414, pickup_id=, customer_enable=false, createdAt=null, eq_type_enable=false, max_distance_enable=true, customer_name=, id=b4644b7c-7aaf-4aaa-b3a1-fbec1124949b, customer_id=, max_distance=250, updatedAt=null}, modelName=UserFilter} I/amplify:flutter:datastore(17597): Saved item: SerializedModel{id='b4644b7c-7aaf-4aaa-b3a1-fbec1124949b', serializedData={eq_type_name=, pickup_enable=false, pickup_name=, eq_type_id=, user_position={"lat":51.051929,"lng":-114.1688657}, travel_time_enable=false, travel_time=1.0, userID=a3bc401d-0e8b-453c-9fb1-e9819dff6414, pickup_id=, customer_enable=false, createdAt=null, eq_type_enable=false, max_distance_enable=true, customer_name=, id=b4644b7c-7aaf-4aaa-b3a1-fbec1124949b, customer_id=, max_distance=250, updatedAt=null}, modelName=UserFilter} I/amplify:aws-datastore(17597): Successfully removed from mutations outboxPendingMutation{mutatedItem=SerializedModel{id='b4644b7c-7aaf-4aaa-b3a1-fbec1124949b', serializedData={eq_type_name=, pickup_enable=false, pickup_name=, eq_type_id=, user_position={"lat":51.0519333,"lng":-114.1688637}, travel_time_enable=false, travel_time=1, userID=a3bc401d-0e8b-453c-9fb1-e9819dff6414, pickup_id=, customer_enable=false, createdAt=null, eq_type_enable=false, max_distance_enable=true, customer_name=, id=b4644b7c-7aaf-4aaa-b3a1-fbec1124949b, customer_id=, max_distance=250, updatedAt=null}, modelName=UserFilter}, mutationType=UPDATE, mutationId=560a7361-33c6-11ed-a124-6b8981457a9b, predicate=MatchAllQueryPredicate} I/amplify:aws-datastore(17597): Successfully enqueued PendingMutation{mutatedItem=SerializedModel{id='b4644b7c-7aaf-4aaa-b3a1-fbec1124949b', serializedData={eq_type_name=, pickup_enable=false, pickup_name=, eq_type_id=, user_position={"lat":51.051929,"lng":-114.1688657}, travel_time_enable=false, travel_time=1.0, userID=a3bc401d-0e8b-453c-9fb1-e9819dff6414, pickup_id=, customer_enable=false, createdAt=null, eq_type_enable=false, max_distance_enable=true, customer_name=, id=b4644b7c-7aaf-4aaa-b3a1-fbec1124949b, customer_id=, max_distance=250, updatedAt=null}, modelName=UserFilter}, mutationType=UPDATE, mutationId=0de0943a-33cc-11ed-9c87-59d141c23066, predicate=MatchAllQueryPredicate} I/amplify:aws-datastore(17597): Successfully removed from mutations outboxPendingMutation{mutatedItem=SerializedModel{id='b4644b7c-7aaf-4aaa-b3a1-fbec1124949b', serializedData={eq_type_name=, pickup_enable=false, pickup_name=, eq_type_id=, user_position={"lat":51.0519333,"lng":-114.1688637}, travel_time_enable=false, travel_time=1, userID=a3bc401d-0e8b-453c-9fb1-e9819dff6414, pickup_id=, customer_enable=false, createdAt=null, eq_type_enable=false, max_distance_enable=true, customer_name=, id=b4644b7c-7aaf-4aaa-b3a1-fbec1124949b, customer_id=, max_distance=250, updatedAt=null}, modelName=UserFilter}, mutationType=UPDATE, mutationId=560a7361-33c6-11ed-a124-6b8981457a9b, predicate=MatchAllQueryPredicate} I/amplify:aws-datastore(17597): Successfully enqueued PendingMutation{mutatedItem=SerializedModel{id='b4644b7c-7aaf-4aaa-b3a1-fbec1124949b', serializedData={eq_type_name=, pickup_enable=false, pickup_name=, eq_type_id=, user_position={"lat":51.051929,"lng":-114.1688657}, travel_time_enable=false, travel_time=1.0, userID=a3bc401d-0e8b-453c-9fb1-e9819dff6414, pickup_id=, customer_enable=false, createdAt=null, eq_type_enable=false, max_distance_enable=true, customer_name=, id=b4644b7c-7aaf-4aaa-b3a1-fbec1124949b, customer_id=, max_distance=250, updatedAt=null}, modelName=UserFilter}, mutationType=UPDATE, mutationId=0de8837c-33cc-11ed-9c87-011bf2a9f7ea, predicate=MatchAllQueryPredicate} D/TSLocationManager(17597): [c.t.l.service.AbstractService start] D/TSLocationManager(17597): 🎾 LocationRequestService [eventCount: 1] I/TSLocationManager(17597): [c.t.l.s.LocationRequestService handleLocationResult] I/TSLocationManager(17597): ╔═════════════════════════════════════════════ I/TSLocationManager(17597): ║ motionchange LocationResult: 2 I/TSLocationManager(17597): ╠═════════════════════════════════════════════ I/TSLocationManager(17597): ╟─ 📍 Location[fused 51.051927,-114.168855 hAcc=11 et=+3d22h27m47s846ms alt=1161.300048828125 vAcc=1 sAcc=??? bAcc=??? {Bundle[mParcelledData.dataSize=728]}], age: 136ms, time: 1663118702671 I/TSLocationManager(17597): [c.t.l.l.TSLocationManager onSingleLocationResult] I/TSLocationManager(17597): 🔵 Acquired motionchange position, isMoving: true D/TSLocationManager(17597): [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 11.432 D/TSLocationManager(17597): [c.t.l.service.AbstractService finish] ⚙️︎ finish LocationRequestService [eventCount: 0, sticky: false] D/TSLocationManager(17597): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(17597): 🔴 LocationRequestService stopped E/AndroidRuntime(17597): FATAL EXCEPTION: pool-9-thread-1 E/AndroidRuntime(17597): Process: com.laprairie.lms, PID: 17597 E/AndroidRuntime(17597): java.lang.IllegalArgumentException: Invalid latitude: -114.05992704473897 E/AndroidRuntime(17597): at com.google.android.gms.common.internal.Preconditions.checkArgument(com.google.android.gms:play-services-basement@@18.0.0:2) E/AndroidRuntime(17597): at com.google.android.gms.location.Geofence$Builder.setCircularRegion(com.google.android.gms:play-services-location@@20.0.0:1) E/AndroidRuntime(17597): at com.transistorsoft.locationmanager.geofence.TSGeofence.build(Unknown Source:60) E/AndroidRuntime(17597): at com.transistorsoft.locationmanager.geofence.TSGeofenceManager$f.run(Unknown Source:414) E/AndroidRuntime(17597): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/AndroidRuntime(17597): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/AndroidRuntime(17597): at java.lang.Thread.run(Thread.java:764) E/TSLocationManager(17597): [c.t.l.a.BackgroundGeolocation$w0 uncaughtException] E/TSLocationManager(17597): ‼️ Uncaught Exception: Invalid latitude: -114.05992704473897 E/TSLocationManager(17597): {"activityRecognitionInterval":10000,"allowIdenticalLocations":false,"authorization":{},"autoSync":false,"autoSyncThreshold":0,"backgroundPermissionRationale":{"title":"Allow {applicationName} to access this device's location even when the app is closed or not in use.","message":"This app collects location data to enable recording your trips to work and calculate distance-travelled.","positiveAction":"Change to \"{backgroundPermissionOptionLabel}\"","negativeAction":"Cancel"},"batchSync":false,"configUrl":"","debug":true,"deferTime":0,"desiredAccuracy":-2,"desiredOdometerAccuracy":100,"disableAutoSyncOnCellular":false,"disableElasticity":false,"disableLocationAuthorizationAlert":false,"disableMotionActivityUpdates":false,"disableStopDetection":false,"distanceFilter":100,"elasticityMultiplier":1,"enableHeadless":true,"enableTimestampMeta":false,"extras":{},"fastestLocationUpdateInterval":-1,"foregroundService":true,"geofenceInitialTriggerEntry":true,"geofenceModeHighAccuracy":false,"geofenceProximityRadius":1000,"geofenceTemplate":"","headers":{},"headlessJobService":"com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask","heartbeatInterval":60,"httpRootProperty":"location","httpTimeout":60000,"isMoving":true,"locationAuthorizationRequest":"Always","locationTemplate":"","locationTimeout":60,"locationUpdateInterval":1000,"locationsOrderDirection":"ASC","logLevel":5,"logMaxDays":3,"maxBatchSize":-1,"maxDaysToPersist":1,"maxRecordsToPersist":-1,"method":"POST","minimumActivityRecognitionConfidence":75,"motionTriggerDelay":0,"notification":{"layout":"","title":"","text":"Location Service activated","color":"","channelName":"TSLocationManager","smallIcon":"","largeIcon":"","priority":0,"sticky":false,"strings":{},"actions":[]},"params":{},"persist":true,"persistMode":2,"schedule":[],"scheduleUseAlarmManager":false,"speedJumpFilter":300,"startOnBoot":true,"stationaryRadius":25,"stopAfterElapsedMinutes":0,"stopOnStationary":false,"stopOnTerminate":true,"stopTimeout":5,"triggerActivities":"in_vehicle, on_bicycle, on_foot, running, walking","url":"","useSignificantChangesOnly":false,"enabled":true,"schedulerEnabled":false,"trackingMode":1,"odometer":0,"isFirstBoot":false,"didLaunchInBackground":false,"didDeviceReboot":false} E/TSLocationManager(17597): java.lang.IllegalArgumentException: Invalid latitude: -114.05992704473897 E/TSLocationManager(17597): at com.google.android.gms.common.internal.Preconditions.checkArgument(com.google.android.gms:play-services-basement@@18.0.0:2) E/TSLocationManager(17597): at com.google.android.gms.location.Geofence$Builder.setCircularRegion(com.google.android.gms:play-services-location@@20.0.0:1) E/TSLocationManager(17597): at com.transistorsoft.locationmanager.geofence.TSGeofence.build(Unknown Source:60) E/TSLocationManager(17597): at com.transistorsoft.locationmanager.geofence.TSGeofenceManager$f.run(Unknown Source:414) E/TSLocationManager(17597): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/TSLocationManager(17597): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/TSLocationManager(17597): at java.lang.Thread.run(Thread.java:764) D/AutoSessionTracker(17597): Activity paused: MainActivity I/MediaPlayer(17597): Need to enable context aware info V/MediaPlayer-JNI(17597): native_setup V/MediaPlayerNative(17597): constructor V/MediaPlayerNative(17597): setListener V/MediaPlayer-JNI(17597): setVolume: left 1.000000 right 1.000000 V/MediaPlayerNative(17597): MediaPlayer::setVolume(1.000000, 1.000000) V/MediaPlayer-JNI(17597): setAuxEffectSendLevel: level 0.000000 V/MediaPlayerNative(17597): MediaPlayer::setAuxEffectSendLevel(0.000000) V/MediaPlayer-JNI(17597): setParameter: key 1400 V/MediaPlayerNative(17597): MediaPlayer::setParameter(1400) V/MediaPlayer-JNI(17597): set_session_id(): 2049 V/MediaPlayerNative(17597): MediaPlayer::setAudioSessionId(2049) V/MediaPlayer-JNI(17597): setDataSourceFD: fd 137 V/MediaPlayerNative(17597): setDataSource(137, 228554128, 39750) D/ViewRootImpl@1a329MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 1 D/InputMethodManager(17597): prepareNavigationBarInfo() DecorView@e98bf0[MainActivity] D/InputMethodManager(17597): getNavigationBarColor() -855310 I/Process (17597): Sending signal. PID: 17597 SIG: 9 Lost connection to device. Exited

christocracy commented 2 years ago

I suggest you have a look at the geofences you’re adding.

You’ve got latitude and longitude mixed up somewhere.

tegaologe commented 2 years ago

I suggest you have a look at the geofences you’re adding.

You’ve got latitude and longitude mixed up somewhere.

i have reviewed geofence and also removed any geofence but i am still getting similar result

tegaologe commented 2 years ago

i have also tried older version of the plugin with no solution

christocracy commented 2 years ago

com.transistorsoft.locationmanager.geofence.TSGeofence.build

The crash occurred while building a geofence.

christocracy commented 2 years ago

The problem is in your own code.

I suggest you first install the /example app in this repo.

Srj-Love commented 1 year ago

Hey there, I also encountering this issues. Here is the Scenarios I do for crashing

    1. I added invalid latitude -123.234444 inside the bg.BackgroundGeolocation.addGeofence
    1. Run my app and check that my app were crashing because of latitude were not proper
  1. Again I reverted my code with proper latitude and ran my code, but in this case expecation was my app will not crash, but it revesed the case. It crashed again with the same issue
  2. I added
    await bg.BackgroundGeolocation.removeGeofences(); and await bg.BackgroundGeolocation.destroyLocations(); before calling my bg.BackgroundGeolocation.addGeofence but it crashed the app.

Is there any solution that my app should not crash but it give me kind of exceptions.

  ```sendDataToEvent(GeoDetails data, int i) async {
double _campusRadius = 500.0;
try{
  final radiusString = data.radius!.replaceAll(RegExp(' Meters'), '');
  _campusRadius = double.parse(radiusString);
} on Exception catch(e){
  FirebaseCrashlytics.instance.log('gf radius is null ');

}
// double new_latitude = double.parse('-117.16848');
// double new_longitude = double.parse('32.70979');

print("Server data:- ${data}");

var logData = {
  'latitude':data.latitude,
  'longitude':data.longitude,
};

if(data.longitude != null && data.latitude!=null){
  bool cordsValidated=isLatLongValid(data.latitude!,data.longitude!);
  if(cordsValidated){
    try {

      double new_latitude = data.latitude!;
      double new_longitude = data.longitude!;

      print("lat long from server:- lat:- ${data.latitude}  & long:- ${data.longitude}");

      await bg.BackgroundGeolocation.removeGeofences();
      await bg.BackgroundGeolocation.destroyLocations();

      await bg.BackgroundGeolocation.addGeofence(bg.Geofence(
          identifier: "${geofencingCampusList!.location![i].id ?? 0}",
          radius: _campusRadius,
          latitude:new_latitude, //_geofencingController.geofencingCampusList!.location![i].geoDetails?.latitude ?? 00.0,//center.latitude,
          longitude: new_longitude,//_geofencingController.geofencingCampusList!.location![i].geoDetails?.longitude ?? 00.0,//center.longitude,
          notifyOnEntry: _notifyOnEntry,
          notifyOnExit: _notifyOnExit,
          notifyOnDwell: _notifyOnDwell,
          loiteringDelay: _loiteringDelay,
          extras: {
            'radius': _campusRadius,
            'center': {'latitude':new_latitude, 'longitude':new_longitude}
          } // meta-data for tracker.transistorsoft.com
      )).then((bool success) {

        print('addGeofence  Success Internal');

      }).catchError((error) {
        print('[addGeofence] ERROR: $error');
        FirebaseAnalyticService.loggError( 'geofence_lib_failed');

        //FirebaseCrashlytics.instance.log('Geofence lib failed with $error');

      });
    } on Exception catch (e) {
      print("Error:- ${e}");
    }

  }else{

    FirebaseAnalyticService.loggError( 'latlong_out_bounds');

  }
}else{
  FirebaseAnalyticService.loggError( 'latlong_null');

}

}```

Srj-Love commented 1 year ago

Hey @christocracy , any update on this. our build is in release mode and we're getting crash several time after fixes too. Thanks for taking a look in advance.

christocracy commented 1 year ago

If you have a crash, why are you not posting the stacktrace? There’s always a stacktrace

Srj-Love commented 1 year ago

Sure, here it is:

2023-08-21 12:41:28.893 28441-28637 AndroidRuntime          org.hccts.brain.dev                  E  FATAL EXCEPTION: pool-23-thread-1
                                                                                                    Process: org.hccts.brain.dev, PID: 28441
                                                                                                    java.lang.IllegalArgumentException: Invalid latitude: -143.333333
                                                                                                        at com.google.android.gms.common.internal.Preconditions.checkArgument(com.google.android.gms:play-services-basement@@18.2.0:2)
                                                                                                        at com.google.android.gms.location.Geofence$Builder.setCircularRegion(com.google.android.gms:play-services-location@@21.0.1:1)
                                                                                                        at com.transistorsoft.xms.g.location.Geofence$Builder.setCircularRegion(Unknown Source:58)
                                                                                                        at com.transistorsoft.locationmanager.geofence.TSGeofence.build(Unknown Source:76)
                                                                                                        at com.transistorsoft.locationmanager.geofence.TSGeofenceManager$f.run(Unknown Source:426)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                                                                                                        at java.lang.Thread.run(Thread.java:1012)

2023-08-21 12:41:28.958 28441-28637 TSLocationManager       org.hccts.brain.dev                  E  [c.t.l.a.BackgroundGeolocation$w0 uncaughtException] 
                                                                                                      ‼️  Uncaught Exception: Invalid latitude: -143.333333
                                                                                                    {"activityRecognitionInterval":10000,"allowIdenticalLocations":false,"authorization":{},"autoSync":true,"autoSyncThreshold":0,"backgroundPermissionRationale":{"title":"Allow {applicationName} to access this device's location even when the app is closed or not in use.","message":"This app collects location data to enable recording your campus location","positiveAction":"Change to \"{backgroundPermissionOptionLabel}\"","negativeAction":"Cancel"},"batchSync":false,"configUrl":"","debug":false,"deferTime":0,"desiredAccuracy":-2,"desiredOdometerAccuracy":100,"disableAutoSyncOnCellular":false,"disableElasticity":false,"disableLocationAuthorizationAlert":false,"disableMotionActivityUpdates":false,"disableProviderChangeRecord":false,"disableStopDetection":false,"distanceFilter":10,"elasticityMultiplier":1,"enableHeadless":true,"enableTimestampMeta":false,"extras":{},"fastestLocationUpdateInterval":-1,"foregroundService":true,"geofenceInitialTriggerEntry":true,"geofenceModeHighAccuracy":false,"geofenceProximityRadius":1000,"geofenceTemplate":"","headers":{},"headlessJobService":"com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask","heartbeatInterval":60,"httpRootProperty":"location","httpTimeout":60000,"isMoving":true,"locationAuthorizationRequest":"Always","locationTemplate":"","locationTimeout":60,"locationUpdateInterval":1000,"locationsOrderDirection":"ASC","logLevel":5,"logMaxDays":3,"maxBatchSize":-1,"maxDaysToPersist":1,"maxRecordsToPersist":-1,"method":"POST","minimumActivityRecognitionConfidence":75,"motionTriggerDelay":0,"notification":{"layout":"","title":"","text":"Location Service activated","color":"","channelName":"TSLocationManager","channelId":"","smallIcon":"","largeIcon":"","priority":0,"sticky":false,"strings":{},"actions":[]},"params":{},"persist":true,"persistMode":2,"schedule":[],"scheduleUseAlarmManager":false,"speedJumpFilter":300,"startOnBoot":true,"stationaryRadius":25,"stopAfterElapsedMinutes":0,"stopOnStationary":false,"stopOnTerminate":false,"stopTimeout":5,"triggerActivities":"in_vehicle, on_bicycle, on_foot, running, walking","url":"","useSignificantChangesOnly":false,"enabled":true,"schedulerEnabled":false,"trackingMode":1,"odometer":809.694091796875,"isFirstBoot":false,"didLaunchInBackground":false,"didDeviceReboot":false}
                                                                                                    java.lang.IllegalArgumentException: Invalid latitude: -143.333333
                                                                                                        at com.google.android.gms.common.internal.Preconditions.checkArgument(com.google.android.gms:play-services-basement@@18.2.0:2)
                                                                                                        at com.google.android.gms.location.Geofence$Builder.setCircularRegion(com.google.android.gms:play-services-location@@21.0.1:1)
                                                                                                        at com.transistorsoft.xms.g.location.Geofence$Builder.setCircularRegion(Unknown Source:58)
                                                                                                        at com.transistorsoft.locationmanager.geofence.TSGeofence.build(Unknown Source:76)
                                                                                                        at com.transistorsoft.locationmanager.geofence.TSGeofenceManager$f.run(Unknown Source:426)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                                                                                                        at java.lang.Thread.run(Thread.java:1012)
christocracy commented 1 year ago

I have reproduced this.

christocracy commented 1 year ago

I have added sanity-checking to handle this invalid data.

In the meantime, you can work around this as follows:

// First remove geofences BEFORE calling .ready.  Be sure to await.
// You could use .getGeofences() and iterate to only remove the one(s) with error.
await bg.BackgroundGeolocation.removeGeofences();

bg.BackgroundGeolocation.ready(bg.Config(
  .
  .
  .
));
christocracy commented 1 year ago

The fix will be applied to the latest version (which will be 4.12.1)

Srj-Love commented 1 year ago

Thank's it resolved.

christocracy commented 1 year ago

org.hccts.brain.dev

Unrelated question: I have someone spamming my test server (likely inadvertently) at https://tracker.transistorsoft.com using an org name of "brain".

Is that something that might be related to you?

christocracy commented 1 year ago

The locations of this "brain" are coming from California

Srj-Love commented 1 year ago

Yeah, that's is us. we're using a flavor for testing only.

christocracy commented 1 year ago

You need to STOP hitting my server. I've already banned that org name brain from inserting locations into my database and the http requests are getting returned 403 AccessDenied.

Clone your own instance of background-geolocation-console server and stop hitting mine.