Closed LocaTrackGitHub closed 2 years ago
iPhone Crash
Where is the stacktrace?
What stacktraces this is a tester reporting this not on my local...not sure what you mean with that? There is no logs and no errors just a guy driving and the background sometimes kicking in sometimes not...
Without a stacktrace specifically referencing this plugin, it's impossible to say that your crash is due to the plugin or a bug in your own code.
People often use Crashalytics, like the guy in that other issue you posted in.
Also it tracks lines like this....which to me seems odd and perhaps delayed entries causing it... I will check out crashalytics in tne mean time... Any idea what is causing the lines?
See api docs Config.distanceFilter to learn about "distanceFilter elasticity"
Thank you will look into that, this project dont use firebase, seems like crashalytics is based on a firebase project, is there any other flutter crash reporting tool I can use to get you the stack trace?
here is log i think may help u i have same issue :
Metal: MTLReleaseAssertionFailure + 220
@heshesh2010 your posted stack-trace has nothing to do with this plugin. When you have an iOS stack-trace that references this plugin, you will see symbols referencing TSLocationManager
, or other symbols beginning with the prefix TS
(for Transistor Software).
I hope this could somehow help one is a screenshot of how an app I paid for tracks me and the other one where I seem to get preiodic background updates. Both apps were closed whilst driving so I assume its something to do with the background tracking. I am hoping its something implemented wrong or a small adustment that can fix this.
Why don't you install the /example in this repo and compare that?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.
Your Environment
flutter doctor
): flutter doctor -v [✓] Flutter (Channel stable, 2.2.0, on macOS 11.6 20G165 darwin-x64, locale af-ZA) • Flutter version 2.2.0 at /Library/WebServer/Documents/flutter • Framework revision b22742018b (5 months ago), 2021-05-14 19:12:57 -0700 • Engine revision a9d88a4d18 • Dart version 2.13.0[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/hen3/Library/Android/sdk • Platform android-30, build-tools 29.0.3 • ANDROID_HOME = /Users/hen3/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.11.2
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.61.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.27.0
[✓] VS Code (version 1.44.0) • VS Code at /Users/hen3/Applications/Visual Studio Code.app/Contents • Flutter extension version 3.27.0
[✓] Connected device (3 available) • Land Rover Explore (mobile) • MP6J427N4778688 • android-arm64 • Android 8.1.0 (API 27) • iPhone 12 Pro (mobile) • 71CE28A0-7CF4-4E60-8139-9AE819718DE5 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
--- in init bg.BackgroundGeolocation.onLocation((bg.Location location) { _onLocation(location); }); bg.BackgroundGeolocation.onMotionChange((bg.Location location) { _onLocation(location); }); (() async { bg.BackgroundGeolocation.ready(bg.Config( desiredAccuracy: logAccuracyLevel, distanceFilter: 10.0, stopOnTerminate: false, enableHeadless: true, startOnBoot: true, debug: false, reset: true, autoSync: true, foregroundService: true, url: constants.baseServiceUrlH+'/locatrack/user/location/transistorsoft/insert/', params: { "myParams": {"deviceId" : await PlatformDeviceId.getDeviceId} }, logLevel: bg.Config.LOG_LEVEL_WARNING, )).then((bg.State state) { if (!state.enabled) { //// // 3. Start the plugin. // bg.BackgroundGeolocation.start(); print('Started bg.BackgroundGeolocation'); } }); })();
--- in main bg.BackgroundGeolocation.registerHeadlessTask(headlessTask);
---headless
void headlessTask(bg.HeadlessEvent headlessEvent) async { print('[BackgroundGeolocation HeadlessTask]: $headlessEvent'); // Implement a 'case' for only those events you're interested in. switch(headlessEvent.name) { case bg.Event.TERMINATE: bg.State state = headlessEvent.event; print('- State: $state'); break; case bg.Event.HEARTBEAT: bg.HeartbeatEvent event = headlessEvent.event; print('- HeartbeatEvent: $event'); break; case bg.Event.LOCATION: bg.Location location = headlessEvent.event; print('[bg.BackgroundGeolocation.onLocation 2] - : $location'); _onLocation(location); break; case bg.Event.MOTIONCHANGE: bg.Location location = headlessEvent.event; print('- Location: $location'); _onLocation(location); break; case bg.Event.GEOFENCE: bg.GeofenceEvent geofenceEvent = headlessEvent.event; print('- GeofenceEvent: $geofenceEvent'); break; case bg.Event.GEOFENCESCHANGE: bg.GeofencesChangeEvent event = headlessEvent.event; print('- GeofencesChangeEvent: $event'); break; case bg.Event.SCHEDULE: bg.State state = headlessEvent.event; print('- State: $state'); break; case bg.Event.ACTIVITYCHANGE: bg.ActivityChangeEvent event = headlessEvent.event; print('ActivityChangeEvent: $event'); break; case bg.Event.HTTP: bg.HttpEvent response = headlessEvent.event; print('HttpEvent: $response'); break; case bg.Event.POWERSAVECHANGE: bool enabled = headlessEvent.event; print('ProviderChangeEvent: $enabled'); break; case bg.Event.CONNECTIVITYCHANGE: bg.ConnectivityChangeEvent event = headlessEvent.event; print('ConnectivityChangeEvent: $event'); break; case bg.Event.ENABLEDCHANGE: bool enabled = headlessEvent.event; print('EnabledChangeEvent: $enabled'); break; } }
--- onLocation void _onLocation(bg.Location location) async { var _myService = locator();
FlutterSecureStorage _storage = FlutterSecureStorage();
var token = await _storage.read(key: 'token');
if (['', null, false, 0].contains(token)) {
token = await _storage.read(key: 'token_old');
}
if (!['', null, false, 0].contains(token)) {
var deviceId = await PlatformDeviceId.getDeviceId;
deviceId ??= "notset";
//print('MMM');
print('Saving location.... token= ${token} pos=${location.coords.latitude},${location.coords.longitude} on device ${deviceId}');
var stringExtra= '{"activity":${location.activity.toString()}, "batteryis":${location.battery.toString()},"extras":${location.extras.toString()},"geofence":${location.geofence.toString()},"isMoving":${location.isMoving.toString()},"map":${location.map.toString()},"odometer":${location.odometer.toString()},"sample":${location.sample.toString()},"timestamp":${location.timestamp.toString()},","uuid":${location.uuid.toString()}}';
print(stringExtra);
var responseCode = await _myService.saveLocation(
token, location.coords.latitude, location.coords.longitude, deviceId, stringExtra);
print('Response was ${responseCode}');
}
}