-
Notifications
You must be signed in to change notification settings - Fork 263
Open
Labels
AndroidIssues specific to the Android PlatformIssues specific to the Android PlatformbugSomething is not working; the issue has reproducible steps and has been reproducedSomething is not working; the issue has reproducible steps and has been reproducedpush notifications
Description
Description
After completing the workmanager task, the application crashes when receiving a push notification.
D/AmplifyAuthCognitoPlugin( 7925): onAttachedToEngine
I/flutter ( 7925): executeTask
I/WM-WorkerWrapper( 7925): Worker result SUCCESS for Work [ id=2457b878-41f6-4e94-a6f7-571d215f354b, tags={ dev.fluttercommunity.workmanager.BackgroundWorker } ]
D/AmplifyAuthCognitoPlugin( 7925): onDetachedFromEngine
D/AmplifyAuthCognitoPlugin( 7925): [cancelCurrentOperation] Canceling with state: signInResult=null, signOutResult=null
D/AndroidRuntime( 7925): Shutting down VM
E/AndroidRuntime( 7925): FATAL EXCEPTION: main
E/AndroidRuntime( 7925): Process: com.example.app, PID: 7925
E/AndroidRuntime( 7925): java.lang.NullPointerException
E/AndroidRuntime( 7925): at com.amazonaws.amplify.amplify_push_notifications.PushNotificationFirebaseMessagingService.handleMessageReceived$lambda$3(PushNotificationFirebaseMessagingService.kt:72)
E/AndroidRuntime( 7925): at com.amazonaws.amplify.amplify_push_notifications.PushNotificationFirebaseMessagingService.$r8$lambda$3gv-VezmiX7SI0LpF2RU5uWz5uo(Unknown Source:0)
E/AndroidRuntime( 7925): at com.amazonaws.amplify.amplify_push_notifications.PushNotificationFirebaseMessagingService$$ExternalSyntheticLambda1.run(Unknown Source:6)
E/AndroidRuntime( 7925): at android.os.Handler.handleCallback(Handler.java:942)
E/AndroidRuntime( 7925): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 7925): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime( 7925): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime( 7925): at android.app.ActivityThread.main(ActivityThread.java:8144)
E/AndroidRuntime( 7925): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7925): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:573)
E/AndroidRuntime( 7925): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1023)
Categories
- Analytics
- API (REST)
- API (GraphQL)
- Auth
- Authenticator
- DataStore
- Notifications (Push)
- Storage
Steps to Reproduce
@pragma('vm:entry-point')
void callbackDispatcher() {
Workmanager().executeTask((task, inputData) async {
safePrint("executeTask");
return Future.value(true);
});
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
final auth = AmplifyAuthCognito();
final pushPlugin = AmplifyPushNotificationsPinpoint();
await Amplify.addPlugins([auth, pushPlugin]);
await Amplify.configure(amplifyconfig);
Amplify.Notifications.Push.onTokenReceived.listen((event) {
safePrint("onTokenReceived: $event");
});
Workmanager().initialize(callbackDispatcher, isInDebugMode: true);
// no error if you comment this
Workmanager().registerOneOffTask("test", "test");
runApp(const MyApp());
}
Screenshots
No response
Platforms
- iOS
- Android
- Web
- macOS
- Windows
- Linux
Flutter Version
3.22.3
Amplify Flutter Version
2.3.0
Deployment Method
Custom Pipeline
Schema
No response
Metadata
Metadata
Assignees
Labels
AndroidIssues specific to the Android PlatformIssues specific to the Android PlatformbugSomething is not working; the issue has reproducible steps and has been reproducedSomething is not working; the issue has reproducible steps and has been reproducedpush notifications