Closed tiitha closed 4 months ago
It’s because you’re using the emulator. See wiki “Debugging”.
go outside with a real device and walk at least 200 meters.
The exact same thing happened with Samsung Galaxy Tab Active5 (Android 14), travelled about 6km with a car and tested it some times. Otherwise I would have suspected the emulators' location issues or sth. I'll give it another try tomorrow
Also see https://dontkillmyapp.com
Also see https://dontkillmyapp.com
I would agree in the case if the app wouldn't work while being on the background etc, but it works .. just after the google maps trick .. and not before..
Samsung Galaxy Tab Active5
This looks like a wifi-only tablet. test on a phone with GPS.
Samsung Galaxy Tab Active5
This looks like a wifi-only tablet. test on a phone with GPS.
Looking at the specification it seems that it has GPS: https://www.samsung.com/uk/tablets/others/galaxy-tab-active5-green-128gb-sm-x306bzgaeea/#specs "Navigation: GPS, GLONASS, BDS, GALILEO, QZSS" .. And looking at Google Maps App it can show my real-time location as it should. Further more: my own application works just fine AFTER I have used google maps for a second. Might there be some kind of subscription or initialization issue of GPS notifications or sth?
Might there be some kind of subscription or initialization issue of GPS notifications or sth?
No.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Your Environment
flutter doctor
): Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-arm64, locale en-EE) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.3) [✓] IntelliJ IDEA Community Edition (version 2022.2) [✓] Connected device (4 available) [✓] Network resources• No issues found!
JsonEncoder encoder = JsonEncoder.withIndent(" ");
class TrackerWidget extends StatefulWidget { String geoape_token = ""; Map settings = {};
reloadTrackerSettings() => createState().reloadTrackerSettings(); getTrackerState() => createState().getTrackerState();
@override _TrackerWidgetState createState() => _TrackerWidgetState(); TrackerWidget();
void setGeoApeToken(String token) { geoape_token = token; } }
class _TrackerWidgetState extends State {
IconData i = Icons.play_arrow; bool _trackerStarted = false; bool? _isMoving = false; bool _enabled = false; String _motionActivity = ""; String _trackingLabel = "Not Tracking"; String _odometer = ""; String _content = ""; String _gpsUpdate = ""; String _geoapeUpload = ""; String _track_token = ""; String _share_token = "";
int _uploaded = 0; String _uploadedTxt = "";
@override void initState() { super.initState(); _trackerStarted = false; _trackingLabel = "Not Tracking"; _isMoving = false; _enabled = false; _content = ''; _odometer = '0'; _uploaded = 0; _gpsUpdate = "never"; _geoapeUpload = "never"; _uploadedTxt = "0 kb"; initializeDateFormatting();
}
Future getTrackerState() async {
bg.State s = await bg.BackgroundGeolocation.state;
return s.enabled;
}
Future reloadTrackerSettings() async {
}
void _onHttp(bg.HttpEvent response) {
} _enableTracker(enabled) async {
} void _onLocationError(bg.LocationError le) { print("LocationError: "+le.message+", "+le.code.toString()); } void _onLocation(bg.Location location) async { print('[location] - $location'); print(". (${await getTrackerState()})"); _gpsUpdate = DateFormat('HH:mm:ss').format(DateTime.now()).toString(); String odometerKM = (location.odometer / 1000.0).toStringAsFixed(1); setState(() { _odometer = odometerKM; }); }
void _startNewTrack() async { await reloadTrackerSettings(); String track = await Geoape.generateTrackToken(widget.geoape_token); print("track: ${track}");
} void _startStopTracker() { if (_trackerStarted) { _enableTracker(false); } else { print("continue or start over?"); final act = CupertinoActionSheet( title: const Text('POSITION TRACKING'), message: const Text('Do You want to continue your previouew track\nor start a new one?'), actions:[
CupertinoActionSheetAction(
child: Text('CONTINUE LAST TRACK', style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 1)),
onPressed: () {
_enableTracker(true);
Navigator.of(context, rootNavigator: true).pop("1");
},
),
CupertinoActionSheetAction(
child: Text('START A NEW TRACK', style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 1)),
onPressed: () {
_startNewTrack();
Navigator.of(context, rootNavigator: true).pop("1");
},
)
],
cancelButton: CupertinoActionSheetAction(
child: Text('CANCEL', style: DefaultTextStyle.of(context).style.apply(fontSizeFactor: 1)),
onPressed: () {
Navigator.pop(context);
},
));
showCupertinoModalPopup(
context: context,
builder: (BuildContext context) => act);
}
}