Baseflow / Baseflow/flutter-geolocator

🚀 WearOS support

Open
#1,197 21 comments 8 reactions 0 assignees View on GitHub
P3 platform: android type: enhancement
Dominant language
Dart
Stars
1.3k
Forks
803
Avg merge
8h 16m
Merged PRs (30d)
1

Description

## 🚀 WearOs Support Feature Request

As WearOS is based on android and works quite similar, it would be great to have geolocator support it.
So far none of the Flutter location packages are supporting WearOS and this could be a great argument to use geolocator.

### Contextualize the feature
Geolocator supports most relevant platforms on which location is required. The only exception being Apple watchOS and Android WearOS. This feature request seeks to address one of these. Doing so would also make geolocator the first flutter plugin that supports location integration on wearOS devices.

### Describe the feature
Ideally the full feature set that is currently supported on mobile android should be supported. If there are limitations, the key features would be a great start.

I suspect the fact that geolocator does not currently work on wearOS, even though it works great on android is mostly due to different permission / service requirements.

### Platforms affected (mark all that apply)
- ☒ :robot: Android

### Test Application
I have set up a very minimal test application to showcase the current behaviour: https://github.com/masus04/Flutter-WearOS-Location/blob/main/README.md

**The same behaviour can be observed when running the application on an emulator in Android Studio or a physical device.**

When running this application on Android mobile / wearOS, the following log is printed:

#### Android Mobile
```
Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
D/FlutterGeolocator( 7053): Attaching Geolocator to activity
D/FlutterGeolocator( 7053): Creating service.
D/FlutterGeolocator( 7053): Binding to location service.
D/FlutterGeolocator( 7053): Geolocator foreground service connected
D/FlutterGeolocator( 7053): Initializing Geolocator services
D/FlutterGeolocator( 7053): Flutter engine connected. Connected engine count 1
Debug service listening on ws://127.0.0.1:36951/LqjelzE7zxs=/ws
Syncing files to device sdk gphone64 x86 64...
I/wearos_location( 7053): Compiler allocated 4533KB to compile void android.view.ViewRootImpl.performTraversals()
I/flutter ( 7053): Initializing GeoLocator
E/FlutterGeolocator( 7053): Geolocator position updates started
E/SurfaceSyncer( 7053): Failed to find sync for id=0
W/Parcel ( 7053): Expecting binder but got null!
D/EGL_emulation( 7053): app_time_stats: avg=21.08ms min=3.63ms max=89.87ms count=20
D/EGL_emulation( 7053): app_time_stats: avg=7.85ms min=1.73ms max=29.29ms count=24
D/EGL_emulation( 7053): app_time_stats: avg=6.34ms min=1.55ms max=32.13ms count=23
D/EGL_emulation( 7053): app_time_stats: avg=5.31ms min=1.67ms max=27.66ms count=28
I/flutter ( 7053): Current Speed: 1.3889987468719482 m/s
I/flutter ( 7053): Current Speed: 1.3889987468719482 m/s
D/EGL_emulation( 7053): app_time_stats: avg=151.05ms min=1.17ms max=1868.30ms count=13
I/flutter ( 7053): Current Speed: 1.3889987468719482 m/s
D/EGL_emulation( 7053): app_time_stats: avg=2997.02ms min=2997.02ms max=2997.02ms count=1
I/flutter ( 7053): Current Speed: 1.3889987468719482 m/s
D/EGL_emulation( 7053): app_time_stats: avg=2985.55ms min=2985.55ms max=2985.55ms count=1
```

#### WearOS
```
Launching lib/main.dart on sdk gwear x86 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
D/FlutterGeolocator( 4135): Attaching Geolocator to activity
D/FlutterGeolocator( 4135): Creating service.
D/FlutterGeolocator( 4135): Binding to location service.
D/FlutterGeolocator( 4135): Geolocator foreground service connected
D/FlutterGeolocator( 4135): Initializing Geolocator services
D/FlutterGeolocator( 4135): Flutter engine connected. Connected engine count 1
Debug service listening on ws://127.0.0.1:39289/2bRo_AjON9Q=/ws
Syncing files to device sdk gwear x86...
I/flutter ( 4135): Initializing GeoLocator
E/FlutterGeolocator( 4135): Geolocator position updates started
I/wearos_locatio( 4135): Waiting for a blocking GC ProfileSaver
I/flutter ( 4135): The following error occurred: The location service on the device is disabled.
I/flutter ( 4135): #0 GeolocatorAndroid.getPositionStream. (package:geolocator_android/src/geolocator_android.dart:187:9)
I/flutter ( 4135): (elided 26 frames from dart:async)
```

This is with the latest Flutter & dependencies at the time of this issue

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported behavior using the linked Flutter-WearOS-Location test application on an Android Studio emulator or physical WearOS device. Start around geolocator_android/src/geolocator_android.dart:187 and compare the Android mobile and WearOS logs; done means the relevant location functionality works on WearOS, including any documented limitations.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.