transistorsoft / background-geolocation-lt

Advanced Background Geolocation & Geofencing SDK for iOS & Android
Other
48 stars 19 forks source link

I can post to our web server's api using Postman, but not from app. #119

Closed fiddlemac closed 1 year ago

fiddlemac commented 1 year ago

I suspect I'm doing something wrong with the api structure or with the config builder. I tried to match the location schema to yours.
I noticed in the logs for the params, the 3 out of 4 are not formatted as strings. I understand if we need to pay a consultancy fee.

Your Environment

in appDelegate: func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { print("AppDelegate received fetch event") let fetchManager = TSBackgroundFetch.sharedInstance() fetchManager?.perform(completionHandler: completionHandler, applicationState: application.applicationState) }

Expected Behavior

Expecting location to be sent to our web server's api. I'm sure I'm doing something wrong.

Actual Behavior

Data never seems to get to server. Maybe our API is not correct structure.

Steps to Reproduce

  1. Start app on iPhone.
  2. Move 15 feet to simulate a location change.

Context

I would like eventually for the plugin to send one current GPS location every 30 minutes. Right now I'm just trying to get it to connect to the api. I can do so in postman using the following schema: { "location": { "coords": { "latitude": 39.3, "longitude": -72.5, "accuracy": 0, "speed": 0, "heading": 0, "altitude": 0 }, "geofence": { "identifier": "string", "action": "string" }, "activity": { "type": "string", "confidence": 0 }, "battery": { "level": 0, "is_charging": true }, "timestamp": "2022-11-02T15:14:53.144Z", "uuid": "string", "event": "string", "is_moving": true, "is_heartbeat": true, "odometer": 0 } } The api also accepts 4 string parameters in addition to the location class: deviceid, regid, timestamp, key

Debug logs

📍<+39.14658737,-77.75961303> +/- 52.33m (speed -1.00 mps / course -1.00) @ 11/6/22, 4:29:23 PM Eastern Standard Time

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 23.3s ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.402775-0500 PhoneTracker[10165:6881533] ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 23.3s ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying... 2022-11-06 16:29:46.406627-0500 PhoneTracker[10165:6881533] ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

📍<+39.14658737,-77.75961303> +/- 52.33m (speed -1.00 mps / course -1.00) @ 11/6/22, 4:29:32 PM Eastern Standard Time 2022-11-06 16:29:46.407802-0500 PhoneTracker[10165:6881533] 📍<+39.14658737,-77.75961303> +/- 52.33m (speed -1.00 mps / course -1.00) @ 11/6/22, 4:29:32 PM Eastern Standard Time

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 14.3s ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.410043-0500 PhoneTracker[10165:6881536] ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 14.3s ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying... 2022-11-06 16:29:46.413710-0500 PhoneTracker[10165:6881536] ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

╔══════════════════════════════════════════════════════════════ 2022-11-06 16:29:46.410043-0500 PhoneTracker[10165:6881536] ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 14.3s ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying... 2022-11-06 16:29:46.413710-0500 PhoneTracker[10165:6881536] ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

╔════════════════════════════════════════════════\342\225═══════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.414449-0500 PhoneTracker[10165:6881536] ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ ✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS 2022-11-06 16:29:46.420917-0500 PhoneTracker[10165:6881533] ✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS

╔═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.410043-0500 PhoneTracker[10165:6881536] ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 14.3s ╚═══════════════════════════════════════════════════════════ ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying... 2022-11-06 16:29:46.413710-0500 PhoneTracker[10165:6881536] ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

╔════════════════════════════════════════════════\342\225═══════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.414449-0500 PhoneTracker[10165:6881536] ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ ✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS 2022-11-06 16:29:46.420917-0500 PhoneTracker[10165:6881533] ✅-[LocationDAO unlock]_block_invoke UNLOCKED ALL RECORDS

╔═════════════════════════════════════════════\342\225══════════════ ║ -[TSHttpService finish:error:] Success: 1 ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.423425-0500 PhoneTracker[10165:6881530] ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 1 ╚═══════════════════════════════════════════════════════════ ℹ️+[LocationAuthorization run:onCancel:] status: 3 2022-11-06 16:29:46.425183-0500 PhoneTracker[10165:6881530] ℹ️+[LocationAuthorization run:onCancel:] status: 3 🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON 2022-11-06 16:29:46.425323-0500 PhoneTracker[10165:6881533] 🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON ℹ️+[LocationAuthorization run:onCancel:] status: 3 2022-11-06 16:29:46.431364-0500 PhoneTracker[10165:6881534] ℹ️+[LocationAuthorization run:onCancel:] status: 3

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/100 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.431509-0500 PhoneTracker[10165:6881533] ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager createMotionTypdeviceToken: C9543C4BD23854D43FBE8CEF9190320C3A9075EFD757606CB2569C8B46964226 eChangedHandler]_block_invoke | still/100 | isMoving: 0 ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.448821-0500 PhoneTracker[10165:6881295] [TSBackgroundFetch scheduleBGAppRefresh] com.transistorsoft.fetch ℹ️-[TSLocationManager startMonitoringBackgroundFetch]_block_invoke Configured BackgroundFetch 2022-11-06 16:29:46.449667-0500 PhoneTracker[10165:6881538] ℹ️-[TSLocationManager startMonitoringBackgroundFetch]_block_invoke Configured BackgroundFetch viewDidAppear Click Send GPS button below to update GPS Location 667.0 Portrait

📍<+39.14658737,-77.75961303> +/- 52.33m (speed -1.00 mps / course -1.00) @ 11/6/22, 4:29:46 PM Eastern Standard Time 2022-11-06 16:29:46.862274-0500 PhoneTracker[10165:6881542] 📍<+39.14658737,-77.75961303> +/- 52.33m (speed -1.00 mps / course -1.00) @ 11/6/22, 4:29:46 PM Eastern Standard Time

╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 0.6s ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.862399-0500 PhoneTracker[10165:6881541] ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 0.6s ╚═══════════════════════════════════════════════════════════ ✅-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+39.14658737,-77.75961303> +/- 52.33m (speed -1.00 mps / course -1.00) @ 11/6/22, 4:29:46 PM Eastern Standard Time 2022-11-06 16:29:46.862930-0500 PhoneTracker[10165:6881542] ✅-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+39.14658737,-77.75961303> +/- 52.33m (speed -1.00 mps / course -1.00) @ 11/6/22, 4:29:46 PM Eastern Standard Time 🔵-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 77 2022-11-06 16:29:46.863177-0500 PhoneTracker[10165:6881542] 🔵-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 77 🔴-[TSLocationManager stopUpdatingLocation] 2022-11-06 16:29:46.867098-0500 PhoneTracker[10165:6881534] 🔴-[TSLocationManager stopUpdatingLocation] [location][AnyHashable("uuid"): 160CFF24-D933-4C07-BAF3-0919F38D5B54, AnyHashable("timestamp"): 2022-11-06T21:29:46.288Z, AnyHashable("odometer"): 45.7, AnyHashable("activity"): { confidence = 100; type = still; }, AnyHashable("is_moving"): 0, AnyHashable("battery"): { "is_charging" = 1; level = 1; }, AnyHashable("extras"): { }, AnyHashable("event"): motionchange, AnyHashable("coords"): { accuracy = "52.3"; altitude = "177.3"; "altitude_accuracy" = "23.1"; floor = ""; heading = "-1"; latitude = "39.14658736999998"; longitude = "-77.75961302999997"; speed = "-1"; }] 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 52.3 2022-11-06 16:29:46.873489-0500 PhoneTracker[10165:6881534] 🔵-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 52.3 🎾-[TSLocationManager startMonitoringSignificantLocationChanges] 2022-11-06 16:29:46.953115-0500 PhoneTracker[10165:6881534] 🎾-[TSLocationManager startMonitoringSignificantLocationChanges] ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 160CFF24-D933-4C07-BAF3-0919F38D5B54 2022-11-06 16:29:46.953717-0500 PhoneTracker[10165:6881584] ✅-[TSLocationManager persistLocation:]_block_invoke INSERT: 160CFF24-D933-4C07-BAF3-0919F38D5B54

╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:46.954843-0500 PhoneTracker[10165:6881534] ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService flush:] ╚═══════════════════════════════════════════════════════════ ✅-[BackgroundTaskManager createBackgroundTask] 2 2022-11-06 16:29:46.955675-0500 PhoneTracker[10165:6881585] ✅-[BackgroundTaskManager createBackgroundTask] 2 ✅-[TSHttpService schedulePost] LOCKED: 160CFF24-D933-4C07-BAF3-0919F38D5B54 2022-11-06 16:29:46.955761-0500 PhoneTracker[10165:6881584] ✅-[TSHttpService schedulePost] LOCKED: 160CFF24-D933-4C07-BAF3-0919F38D5B54 🔵-[HttpResponse handleResponse] Response: 200 2022-11-06 16:29:48.372379-0500 PhoneTracker[10165:6881545] 🔵-[HttpResponse handleResponse] Response: 200 ✅-[TSHttpService post:]_block_invoke DESTROY: 160CFF24-D933-4C07-BAF3-0919F38D5B54 2022-11-06 16:29:48.385119-0500 PhoneTracker[10165:6881584] ✅-[TSHttpService post:]_block_invoke DESTROY: 160CFF24-D933-4C07-BAF3-0919F38D5B54

╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 1 ╚═══════════════════════════════════════════════════════════ 2022-11-06 16:29:48.385604-0500 PhoneTracker[10165:6881543] ╔═══════════════════════════════════════════════════════════ ║ -[TSHttpService finish:error:] Success: 1 ╚═══════════════════════════════════════════════════════════ ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 2 OF ( 2 ) 2022-11-06 16:29:48.385960-0500 PhoneTracker[10165:6881543] ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 2 OF ( 2 )

christocracy commented 1 year ago

I no longer support native app usage of this plugin. This repo no longer receives updates.

I support only cross platform usage with Cordova, Capacitor, React Native and Flutter.