You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using registerInteractivityCallback to call Dart code from a widget, just only increment count sample.
On iOS, the callback works perfectly, even when the app is not running.
However, on Android, the callback does not work if the app has been killed. Only running in the background.
I'm working on: home_widget: 0.5.0
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// Set AppGroup Id. This is needed for iOS Apps to talk to their WidgetExtensionsawaitHomeWidget.setAppGroupId('group.com.example.homeWidgetReminder');
// Register an Interactivity Callback. It is necessary that this method is static and publicawaitHomeWidget.registerInteractivityCallback(interactiveCallback);
runApp(constMyApp());
}
/// Callback invoked by HomeWidget Plugin when performing interactive actions/// The @pragma('vm:entry-point') Notification is required so that the Plugin can find it@pragma('vm:entry-point')
Future<void> interactiveCallback(Uri? uri) async {
// Set AppGroup Id. This is needed for iOS Apps to talk to their WidgetExtensionsawaitHomeWidget.setAppGroupId('group.com.example.homeWidgetReminder');
// We check the host of the uri to determine which action should be triggered.if (uri?.host =='increment') {
await_increment();
} elseif (uri?.host =='clear') {
await_clear();
}
}
const _countKey ='counter';
/// Gets the currently stored ValueFuture<int> get _value async {
final value =awaitHomeWidget.getWidgetData<int>(_countKey, defaultValue:0);
return value!;
}
/// Retrieves the current stored value/// Increments it by one/// Saves that new value/// @returns the new saved valueFuture<int> _increment() async {
final oldValue =await _value;
final newValue = oldValue +1;
await_sendAndUpdate(newValue);
return newValue;
}
What do you expect?
Expect worked on Android even when app being killed
Relevant log output
No response
Execute in a terminal and put output into the code block below
Output of: flutter doctor -v
On which Platform do you experience this issue?
Android
Other information
No response
Are you interested in working on a PR for this?
I want to work on this
The text was updated successfully, but these errors were encountered:
What happened?
I am using registerInteractivityCallback to call Dart code from a widget, just only increment count sample.
On iOS, the callback works perfectly, even when the app is not running.
However, on Android, the callback does not work if the app has been killed. Only running in the background.
I'm working on: home_widget: 0.5.0
What do you expect?
Expect worked on Android even when app being killed
Relevant log output
No response
Execute in a terminal and put output into the code block below
Output of: flutter doctor -v
On which Platform do you experience this issue?
Android
Other information
No response
Are you interested in working on a PR for this?
The text was updated successfully, but these errors were encountered: