transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.54k stars 424 forks source link

SQlite database not store location data after config locationTemplate with 7-8 properties #1990

Closed Sarveshwins closed 1 month ago

Sarveshwins commented 1 month ago

Your Environment

System: OS: macOS 14.4.1 CPU: (8) arm64 Apple M2 Memory: 107.06 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node Yarn: 1.22.21 - ~/Documents/GitHub/alt-tomrex-app/node_modules/.bin/yarn npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.15.0 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2 Android SDK: Not Found IDEs: Android Studio: 2023.1 AI-231.9392.1.2311.11330709 Xcode: 15.2/15C500b - /usr/bin/xcodebuild Languages: Java: 15.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: ^0.64.0 => 0.64.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Expected Behavior

It should have store all the location get from device into SQlite database and send data from there to config.url

Actual Behavior

It gives an error during inserting data in SQlite database and error was. Persistence failure: Expected literal value at character 236 of {"Latitude":30.7173619,"Longitude":76.7007779,"TimeStamp": "2024-04-10T05:38:30.826Z","Uuid": "d3a20ee1-dfca-4528-aaf8-c935eef07916","Event": "","IsMoving": true,"Age":213,"Speed":0.1,"Odometer":904.3,"Mock":false,"Activity": "walking",} org.json.JSONException: Expected literal value at character 236 of {"Latitude":30.7173619,"Longitude":76.7007779,"TimeStamp": "2024-04-10T05:38:30.826Z","Uuid": "d3a20ee1-dfca-4528-aaf8-c935eef07916","Event": "","IsMoving": true,"Age":213,"Speed":0.1,"Odometer":904.3,"Mock":false,"Activity": "walking",} at org.json.JSONTokener.syntaxError(JSONTokener.java:469) at org.json.JSONTokener.readLiteral(JSONTokener.java:297) at org.json.JSONTokener.nextValue(JSONTokener.java:115) at org.json.JSONTokener.readObject(JSONTokener.java:380) at org.json.JSONTokener.nextValue(JSONTokener.java:104) at org.json.JSONObject.(JSONObject.java:168) at org.json.JSONObject.(JSONObject.java:185) at com.transistorsoft.locationmanager.location.TSLocation.renderJson(Unknown Source:95) at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.a(Unknown Source:24) at com.transistorsoft.locationmanager.data.sqlite.SQLiteLocationDAO.persist(Unknown Source:8) at com.transistorsoft.locationmanager.location.TSLocationManager$h.b(Unknown Source:52) at com.transistorsoft.locationmanager.location.TSLocationManager$h.run(Unknown Source:66) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012)

Steps to Reproduce

configure locationTemplate with more than 7 and more properties like i did and check in email logs or in logger's log you will get to see this error

Context

as library provide us around 22 - 23 properties in location response (backgroundgeolocation.getLocation(res=>console.log(res))) but i want only 7-8 prop in my db so i config location template but that me error samsungLog.log realmeLogs.log

christocracy commented 1 month ago

You have a trailing comma after activity

IMG_0740