Skip to content

After upgrading to Android 35, receiving the URI from the widget caused an route push in my app. #341

Open
@armandojimenez

Description

@armandojimenez

What happened?

Hi, after updating to the latest Android SDK and Flutter version, when I tap on my widget using the following code:

// Set the onclick to send the ID of the text to Flutter side
                val pendingIntentWithData = HomeWidgetLaunchIntent.getActivity(
                    context,
                    MainActivity::class.java,
                    "homeWidgetExample://message?message=$displayId".toUri()
                )
                setOnClickPendingIntent(R.id.widget_container, pendingIntentWithData)

The info is received in my callback:

  /// Handle the callback when the widget sends a message
  static void _widgetBackgroundCallback(Uri? uri, {onOpen = false}) {
    Logger.log('Widget clicked!', className: '$HomeWidgetService');
    if (uri != null) {
      final String? message = uri.queryParameters['message'];

      if (StringUtils.isNotEmpty(message) && message != 'noId') {
        getIt<AppProvider>().openPayload = message;

        if (!onOpen) getIt<AppProvider>().showTappedPayload();
      }
    }
  }

But the app pushes a route also, and the screen is now found because of this. How can I fix this? I receive the info set on setOnClickPendingIntent but the app tries to push a new page.

[HomeWidgetService] Widget clicked! [RouteGenerator] Route: /?message=all_kind.294 [BelieveApp] Route not found : /?message=all_kind.294

What do you expect?

Package update or help

Relevant log output

`[HomeWidgetService] Widget clicked!
[RouteGenerator] Route: /?message=all_kind.294
[BelieveApp] Route not found : /?message=all_kind.294`

Execute in a terminal and put output into the code block below

Output of: flutter doctor -v

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.2 24D81 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 16.3)
! CocoaPods 1.15.2 out of date (1.16.2 is recommended).
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.99.0)
[✓] Connected device (5 available)
[✓] Network resources

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions