-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
activity_recognition_flutter 3.0 NullPointer #309
Labels
bugfix
a bug fix
Comments
According to the docs, Android devices target API 30 (Android 11) or later receive a null Proposed fix: public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
String result = sharedPreferences.getString("detected_activity", "error");
Log.d("onSharedPreferenceChang", result);
if (key != null && key.equals("detected_activity")) {
Log.d("activity_recognition_flutter", "Detected activity: " + result);
this.eventSink.success(result);
}
} |
koenniem
added a commit
to koenniem/flutter-plugins
that referenced
this issue
Mar 25, 2021
Also suppressed some warnings that show when building. Changed activity tracking to be a broadcast for a JobIntentService.
Thanks, will fix. |
Fixed in version 3.0.1 |
SteelSavant
pushed a commit
to Photorithm/flutter-plugins
that referenced
this issue
Sep 3, 2021
Also suppressed some warnings that show when building. Changed activity tracking to be a broadcast for a JobIntentService.
hibitness-quan-nguyen2
pushed a commit
to hibitness/flutter-plugins
that referenced
this issue
Dec 18, 2023
Also suppressed some warnings that show when building. Changed activity tracking to be a broadcast for a JobIntentService.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remember to specify the plugin name in the title!
Device / Emulator and OS
Please complete the following information for each phone and/or emulator you're experiencing this bug on:
Describe the bug
In relation to issue #305, when enabling the foreground service the app crashes with a NullPointerException when trying to read the SharedPreference. In
ActivityRecognitionFlutterPlugin.class
:In this code,
key
isnull
causing an exception inif (key.equals("detected_activity")) {
This has also been reported earlier in issue #248.
Additional information
Stacktrace:
The text was updated successfully, but these errors were encountered: