cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
556 stars 682 forks source link

Activity Recognition crashes on android 12 #488

Open nayefradwi opened 2 years ago

nayefradwi commented 2 years ago

Remember to specify the plugin name in the title!

Device / Emulator and OS

Describe the bug

when the activity recognition stream starts, it causes the app to crash, specifically on android 12. All permissions are given before starting the stream yet this still happens. Did not face an issue with other android devices.

To Reproduce

  1. running the app
  2. starting the activity stream

Expected behavior

the stream starts and the activity is recognized

Actual behavior

the app crashes

FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime( 7605): Process: com.oryx.falcon_flex_driver, PID: 7605
E/AndroidRuntime( 7605): java.lang.RuntimeException: An error occurred while executing doInBackground()
E/AndroidRuntime( 7605):    at android.os.AsyncTask$4.done(AsyncTask.java:415)
E/AndroidRuntime( 7605):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
E/AndroidRuntime( 7605):    at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
E/AndroidRuntime( 7605):    at java.util.concurrent.FutureTask.run(FutureTask.java:271)
E/AndroidRuntime( 7605):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime( 7605):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime( 7605):    at java.lang.Thread.run(Thread.java:920)
E/AndroidRuntime( 7605): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.google.android.gms.location.ActivityRecognitionResult.getProbableActivities()' on a null object reference
E/AndroidRuntime( 7605):    at dk.cachet.activity_recognition_flutter.ActivityRecognizedService.onHandleIntent(ActivityRecognizedService.java:36)
E/AndroidRuntime( 7605):    at dk.cachet.activity_recognition_flutter.ActivityRecognizedService.onHandleWork(ActivityRecognizedService.java:30)
E/AndroidRuntime( 7605):    at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:396)
E/AndroidRuntime( 7605):    at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:387)
E/AndroidRuntime( 7605):    at android.os.AsyncTask$3.call(AsyncTask.java:394)
E/AndroidRuntime( 7605):    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/AndroidRuntime( 7605):    ... 3 more

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 11.6 20G165 darwin-arm, locale en-QA)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.63.2)
[✓] Connected device (2 available)

• No issues found!
nayefradwi commented 2 years ago

any updates on this?

lsh411 commented 11 months ago

same issue here. my device is Samsung galaxy s10e (Android 12)