dotnet / dotnet/maui

Navigation after file share intent is not working

Open
#11,754 8 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-controls-shell platform/android s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

Description

If you want to navigate to another page when an intent is called (e.g. to share a pdf file to the MAUI app) the app only opens on the MainPage without any further navigation.

I hope the approach in the reproduction project is the one of the right ways since I have not found any documentation for working with intents in the MAUI context properly.

Steps to Reproduce
  1. Create a File > New .NET MAUI app
  2. Add to the MainActivity the Intent Filters Intent.ActionSend, Intent.ActionView to allow deep linking / opening our Maui app from a URL
[IntentFilter(
    new[] { Intent.ActionSend, Intent.ActionView },
    Categories = new[] { Intent.CategoryDefault },
    DataMimeType = @"application/pdf")]
  1. Set LaunchMode = LaunchMode.SingleTop in Activity
  2. Add a GoToAsync() call for another page in OnNewIntent()
  3. Build and run the app
  4. Open or share a pdf file from another app (e.g. my files app) to the MAUI app

Expected outcome: another page opens
Actual outcome: the MainPage is displayed

Link to public reproduction project repository

https://github.com/daydar-ilx/NavigationAfterIntentBug

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

No response

Relevant log output

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the public NavigationAfterIntentBug reproduction project and inspect MainActivity, especially the OnNewIntent() handler and its GoToAsync() call. Reproduce the file-share or open-intent flow on Android 12, then trace why the app remains on MainPage. Done means the intended page opens after the intent is received.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.