A blank screen appears when app is killed and user taps on a notification
Closed this issue · 2 comments
shahpasandar commented
When user taps on a push notification in killed state of the app then it will open a white blank screen and app stucks on this screen. When app is in background, it will navigate the user to the desire screen.
main.dart:
//Top-level pushy background notification listener
@pragma('vm:entry-point')
void backgroundNotificationListener(Map<String, dynamic> data) {
final result = NotificationData.fromJson(data);
try {
if (!kIsWeb) {
PushNotification().showNotification(data: result);
} else {
Pushy.notify(result.title ?? "", result.body ?? "", data);
}
} catch (e) {
Pushy.notify(result.title ?? "", result.body ?? "", data);
}
Pushy.clearBadge();
}
Future main() async {
await _initApp();
runApp(Application());
}
shahpasandar commented
I'd tried to call register while initializing pushy like this (following method was called in the main.dart):
// Start the Pushy service
Pushy.listen();
// Set custom notification icon (Android)
Pushy.setNotificationIcon('ic_notify');
// Register the device for push notifications
String deviceToken = await Pushy.register();
And then somewhere else in the app life cycle I'd called Pushy.register()
again. I found that the first call of the Pushy.register()
in the main.dart caused this issue.
pushy commented
Hi @shahpasandar,
Thanks for letting us know how you managed to resolve the issue, and glad you were able to find the root cause.