Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void startForegroundService() {
// Pass the notification title/text/icon to the service
intent.putExtra("title", "MonsensoMonitor")
.putExtra("text", "Monsenso Foreground Service")
.putExtra("icon", R.drawable.common_full_open_on_phone)
.putExtra("icon", android.R.drawable.ic_dialog_info)
.putExtra("importance", 3)
.putExtra("id", 10);

Expand Down Expand Up @@ -168,7 +168,7 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
// Log.d("onSharedPreferenceChange", result);
if (key!= null && key.equals(DETECTED_ACTIVITY)) {
// Log.d(TAG, "Detected activity: " + result);
eventSink.success(result);
if (eventSink != null) eventSink.success(result);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ protected void onHandleWork(@Nullable Intent intent) {
// remove override and make onHandleIntent private.
private void onHandleIntent(@Nullable Intent intent) {
ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
if (result == null) return;

List<DetectedActivity> activities = result.getProbableActivities();
if (activities == null || activities.isEmpty()) return;

DetectedActivity mostLikely = activities.get(0);

Expand All @@ -54,6 +57,7 @@ private void onHandleIntent(@Nullable Intent intent) {
SharedPreferences preferences =
getApplicationContext().getSharedPreferences(
ActivityRecognitionFlutterPlugin.ACTIVITY_RECOGNITION, MODE_PRIVATE);
if (preferences == null) return;

preferences.edit().clear()
.putString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void startPluginForegroundService(Bundle extras) {

// Get notification icon
// int icon = getResources().getIdentifier((String) extras.get("icon"), "drawable", context.getPackageName());
int icon = R.drawable.common_full_open_on_phone;
int icon = android.R.drawable.ic_dialog_info;

// Make notification
Notification notification = new Notification.Builder(context, "foreground.service.channel")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
2 changes: 1 addition & 1 deletion packages/activity_recognition_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
permission_handler: ^7.0.0
permission_handler: 11.3.1

flutter:
uses-material-design: true