carp-dk / carp-dk/flutter-plugins

[activity_recognition_flutter-5.0.0]

Open
#949 0 comments 0 reactions 0 assignees View on GitHub
activity_recognition bugfix
Dominant language
Dart
Stars
608
Forks
735
Avg merge
1m
Merged PRs (30d)
3

Description

**Remember to specify the plugin name in the title!**

Plugin: activity_recognition_flutter, last version (5.0.0

### Device / Emulator and OS
Please complete the following information for each phone and/or emulator you're experiencing this bug on:
- Device: Pixel 7 Pro
- OS: Android 14 (API 34)

### Describe the bug
I am getting an exception when granting the permissions and starting the listener.

### To Reproduce
1. I grant permission
2. Invoke: `_activityStreamSubscription = activityRecognition.activityStream().listen(onData, onError: onError);`

### Expected behavior
Start listening to events

### Actual behavior
Throw an exception.

```
D/activity_recognition_flutter(15806): Foreground mode: true
D/activity_recognition_flutter(15806): SDK = 34
D/CompatibilityChangeReporter(15806): Compat change id reported: 160794467; UID 10631; state: ENABLED
D/AndroidRuntime(15806): Shutting down VM
E/AndroidRuntime(15806): FATAL EXCEPTION: main
E/AndroidRuntime(15806): Process: com.objectsm2m.aiko, PID: 15806
E/AndroidRuntime(15806): java.lang.RuntimeException: Unable to create service dk.cachet.activity_recognition_flutter.ForegroundService: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{53dd24e 15806:com.objectsm2m.aiko/u0a631} targetSDK=34
E/AndroidRuntime(15806): at android.app.ActivityThread.handleCreateService(ActivityThread.java:4878)
E/AndroidRuntime(15806): at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
E/AndroidRuntime(15806): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2365)
E/AndroidRuntime(15806): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(15806): at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(15806): at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(15806): at android.app.ActivityThread.main(ActivityThread.java:8501)
E/AndroidRuntime(15806): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15806): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime(15806): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
E/AndroidRuntime(15806): Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{53dd24e 15806:com.objectsm2m.aiko/u0a631} targetSDK=34
E/AndroidRuntime(15806): at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
E/AndroidRuntime(15806): at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
E/AndroidRuntime(15806): at android.os.Parcel.readParcelableInternal(Parcel.java:5015)
E/AndroidRuntime(15806): at android.os.Parcel.readParcelable(Parcel.java:4997)
E/AndroidRuntime(15806): at android.os.Parcel.createExceptionOrNull(Parcel.java:3177)
E/AndroidRuntime(15806): at android.os.Parcel.createException(Parcel.java:3166)
E/AndroidRuntime(15806): at android.os.Parcel.readException(Parcel.java:3149)
E/AndroidRuntime(15806): at android.os.Parcel.readException(Parcel.java:3091)
E/AndroidRuntime(15806): at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6861)
E/AndroidRuntime(15806): at android.app.Service.startForeground(Service.java:775)
E/AndroidRuntime(15806): at dk.cachet.activity_recognition_flutter.ForegroundService.startPluginForegroundService(ForegroundService.java:88)
E/AndroidRuntime(15806): at dk.cachet.activity_recognition_flutter.ForegroundService.onCreate(ForegroundService.java:25)
E/AndroidRuntime(15806): at android.app.ActivityThread.handleCreateService(ActivityThread.java:4865)
E/AndroidRuntime(15806): ... 9 more
W/Sensors (15806): Cannot get virtualdevice_native service
I/Process (15806): Sending signal. PID: 15806 SIG: 9
```

### Screenshots
If applicable, add screenshots to help explain your problem.

### Flutter doctor
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-arm64, locale es-ES)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.88.0)
[✓] VS Code (version 1.82.2)
[✓] Connected device (5 available)
[✓] Network resources

### Additional information
Add any other info about the problem here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.