-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
flutter/plugins
#2453Labels
c: regressionIt was better in the past than it is nowIt was better in the past than it is nowcustomer: productp: android_alarm_managerThe Android background execution pluginThe Android background execution pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specifically
Description
flutter create -a java test_bgcd test_bg- add
android_alarm_manager: anytopubspec.yaml - add to
android/app/src/main/AndroidManifest.xmlthe stuff mentioned on https://pub.dev/packages/android_alarm_manager - delete
test/widget_test.dart - update
lib/main.dartas follows:
import 'dart:io';
import 'dart:isolate';
import 'package:android_alarm_manager/android_alarm_manager.dart';
import 'package:flutter/material.dart';
void callback() {
final DateTime now = DateTime.now();
final int isolateId = Isolate.current.hashCode;
print("[$now] Hello, world! isolate=$isolateId function='$callback'");
}
Future<void> main() async {
runApp(MaterialApp(home: Material(child: Center(child: OutlineButton(child: Text('QUIT'), onPressed: () => exit(0))))));
await AndroidAlarmManager.initialize();
await AndroidAlarmManager.periodic(const Duration(minutes: 1), 0, callback);
}flutter run- Press the QUIT button, or, once the app is running, press Q at the console.
flutter logs- Wait approximately one minute.
Expected results: A Hello world! message with various information like the isolate ID, the time, and some representation of the callback, something like that:
I/flutter (18608): [2019-12-18 20:48:51.063338] Hello, world! isolate=704844194 function='Closure: () => void from Function 'callback': static.'
Actual results:
E/FlutterBackgroundExecutor(17500): Fatal: failed to find callback
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
c: regressionIt was better in the past than it is nowIt was better in the past than it is nowcustomer: productp: android_alarm_managerThe Android background execution pluginThe Android background execution pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specifically