Skip to content

Offline gym log for Android. No account, no ads, no internet.

Declare the receivers that the scheduled notifications need

InlitX1345f0a579f7
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 6ba9458..d2a80bc 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -12,6 +12,7 @@
<!-- MIUI y otras capas matan la app al bloquear; el aviso debe sobrevivir. -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
+ <!-- androidx.work lo mete por su cuenta y la app no toca la red. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" tools:node="remove"/>
<application
@@ -40,7 +41,7 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
- <!-- Widgets de la pantalla de inicio: heatmap (contribuciones) y stats.
+ <!-- Widgets de la pantalla de inicio: heatmap (contribuciones), stats y mapa muscular.
Solo pintan el PNG que renderiza Flutter vía home_widget. -->
<receiver
android:name=".HeatmapWidgetProvider"
@@ -62,6 +63,31 @@
android:name="android.appwidget.provider"
android:resource="@xml/stats_widget_info" />
</receiver>
+ <receiver
+ android:name=".BodyWidgetProvider"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ </intent-filter>
+ <meta-data
+ android:name="android.appwidget.provider"
+ android:resource="@xml/body_widget_info" />
+ </receiver>
+
+ <!-- Sin estos dos, zonedSchedule no dispara nada cuando el sistema mata la app. -->
+ <receiver
+ android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
+ android:exported="false" />
+ <receiver
+ android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
+ android:exported="false">
+ <intent-filter>
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
+ <action android:name="android.intent.action.QUICKBOOT_POWERON" />
+ <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
+ </intent-filter>
+ </receiver>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
diff --git a/lib/services/alarm_store.dart b/lib/services/alarm_store.dart
index f779398..03294f3 100644
--- a/lib/services/alarm_store.dart
+++ b/lib/services/alarm_store.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'dart:typed_data';
import 'package:path_provider/path_provider.dart';
@@ -46,6 +47,18 @@ class AlarmStore {
}
}
+ static Future<String?> saveBytes(String name, Uint8List bytes) async {
+ if (_dir == null) return null;
+ try {
+ await _clear();
+ final base = 'alarm-${DateTime.now().millisecondsSinceEpoch}.${_ext(name)}';
+ await File('$_dir/$base').writeAsBytes(bytes, flush: true);
+ return base;
+ } catch (_) {
+ return null;
+ }
+ }
+
static Future<void> clear() => _clear();
static Future<void> _clear() async {