Skip to content

🐛 [firebase_messaging] Redirect not working on iOS #3868

Closed
@Thorbenl

Description

@Thorbenl

I would like to redirect to a specific screen on tapping the push notification..

      _firebaseMessaging.configure(
          onMessage: (Map<String, dynamic> message) async {
            print("onMessage: $message");
        if (message['data'].containsKey('thread_id')) {
          _navigateToInbox(message);
        }
      }, onLaunch: (Map<String, dynamic> message) async {
        print("onLaunch: $message");
        if (message['data'].containsKey('thread_id')) {
          _navigateToInbox(message);
        }
      }, onResume: (Map<String, dynamic> message) async {
        print("onResume: $message");
        if (message['data'].containsKey('thread_id')) {
          _navigateToInbox(message);
        }
      });

The _navigateToInbox looks like this:

  Future<Object> _navigateToInbox(Map<String, dynamic> message) {
    final threadId = int.parse(message['data']['thread_id']);
    return MyApp.navigatorKey.currentState
        .pushNamed(ThreadScreen.routeName, arguments: threadId);
  }

So i am using the global navigatorKey. This works super fine for Android, iOS just opens the app and does nothing :( Not sure if i am missing anything?

Here is the payload from onResume:

{notification: {}, data: {collapse_key: key, thread_id: 35626, google.original_priority: normal, google.sent_time: 1602751694832, google.delivered_priority: normal, google.ttl: 2419200, from: 894395737756, click_action: FLUTTER_NOTIFICATION_CLICK, google.message_id: 0:1602751694837303%3d33f9053d33f905}}

Here is the output of flutter doctor -v

[✓] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.7 19H2, locale en-DK)
    • Flutter version 1.22.1 at /Users/turbz/flutter
    • Framework revision f30b7f4db9 (7 days ago), 2020-10-08 10:06:30 -0700
    • Engine revision 75bef9f6c8
    • Dart version 2.10.1

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/turbz/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = /Users/turbz/Library/Android/sdk
    • Java binary at: /Users/turbz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6821437/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Users/turbz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6821437/Android Studio.app/Contents
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.50.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.0


[✓] Connected device (2 available)
    • ONEPLUS A6003 (mobile)      • 1b1258f                   • android-arm64 • Android 10 (API 29)
    • iPhone von Jacob (mobile) • 00008030-001125360AE1802E • ios           • iOS 13.7

• No issues found!

Is this a bug? Or intended? Do I miss something?

Metadata

Metadata

Assignees

Labels

blocked: customer-responseWaiting for customer response, e.g. more information was requested.type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions