Repository navigation
feat(flet build): Android queries, scheme-only deep links and activity intent filters - #7031
Open
ndonkoHenri wants to merge 12 commits into
Open
ndonkoHenri wants to merge 12 commits into
ndonkoHenri wants to merge 12 commits into
Conversation
Contributor
|
Sorry @ndonkoHenri, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 1 day and 6 hours by commenting |
flet build): Android queries, scheme-only deep links and activity intent filters
Deploying flet-website-v2 with
|
| Latest commit: |
ee6b7e3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bdf10949.flet-website-v2.pages.dev |
| Branch Preview URL: | https://feat-android-queries-6560.flet-website-v2.pages.dev |
…oks up Android 11+ hides other apps unless the manifest's <queries> names them, so an app couldn't check or open a payment app or a URL scheme handler, and UrlLauncher.can_launch_url() returned False. The new table takes package names, intents (one action, optional categories, data with scheme, host and mimeType at most once each, per Android's <queries> rules) and provider authorities, validated with errors that name the setting. They are rendered after Flet's own PROCESS_TEXT intent.
The Providers, Permissions and Features translations now include what Flet always or by default adds (the FileProvider, INTERNET, leanback and touchscreen), labelled apart from the example's entries, and every manifest translation starts at <manifest> so each element shows under its real parent. The FileProvider note becomes plain text in Providers.
The template always wrote android:label, android:name, android:enableOnBackInvokedCallback and android:icon, then appended every [tool.flet.android.manifest_application] entry, so overriding one of them produced the attribute twice and the Android build failed on the invalid manifest. The attributes are now merged in flet build with the app's entries on top, values are XML-escaped (a product name with "&" broke the manifest too) and booleans are written as true/false.
… top element The Export options, Entitlements and deep-linking translations started at loose <key> or <meta-data> elements; they now start at <plist>/<dict> or <manifest>, so each element shows under its real parent (the deep-link filter under the main activity). The Info.plist translations get one indentation style.
flet build added the Android intent filter and iOS CFBundleURLTypes only when both scheme and host were set, so a myapp:// link couldn't open the app without inventing a host. The scheme alone is now enough: the host is added on Android only if set, and iOS names the URL type after the bundle id without one. A host without a scheme, or http/https without a host, which would make the Android app claim every web link, stops the build. --deep-linking-scheme alone replaces the project settings. Flutter's deep-linking flags are dropped from both templates: they are on by default (verified on an Android emulator and the iOS simulator).
The routing guide gets a Deep links section: a link's path and query become page.route when it opens the app and trigger on_route_change while the app runs. Page.route and on_route_change say so too, and the publish docs link to the guide.
Apps can now add their own intent filters to the main activity, after Flet's launcher and deep-linking filters: several link schemes, hosts or paths, verified App Links (autoVerify), file types or share targets. A filter takes actions, categories, a data table or list whose entries become <data> attributes, and filter attributes. Receivers use the same filter rules, so their filters gain <data> and attributes too. The docs say that links arrive as routes and other intents need native handling.
…filters Cover resolution, validation errors and the rendered Android manifest and iOS Info.plist for the settings added on this branch, and receiver filters with <data> and attributes.
…oid manifest These blocks wrote names and values into AndroidManifest.xml unescaped, so a meta_data value or provider attribute containing &, < or ", such as a URL with a query string, made the manifest invalid and the Android build failed. Every value in the template is now escaped.
ndonkoHenri
force-pushed
the
feat/android-queries-6560
branch
from
November 2, 2026 00:46
3812b06 to
ee6b7e3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets
flet builddeclare more of the Android manifest frompyproject.toml(<queries>, scheme-only deep links, intent filters on the main activity) and fixes three cases where the generatedAndroidManifest.xmlcame out invalid.#6560 asks for two manifest entries that couldn't be set without a custom build template: a URL-scheme intent filter without a host, and
<queries>(for an Alipay integration).<queries>:[tool.flet.android.queries]Android 11+ hides other apps unless the manifest's
<queries>names them, so an app couldn't check for or open a payment app, andUrlLauncher.can_launch_url()returnedFalsefor undeclared schemes.<queries>: exactly one action, andscheme,hostandmimeTypeeach at most once per intent (spread over one or several<data>).path,portandmimeGroupare rejected, with an error that names the setting.com.example.app. A provider entry may list several authorities separated by;. Duplicates are written once.PROCESS_TEXTintent.can_launch_url(): its docstring now says how to declare schemes on Android and iOS.Deep links with only a scheme
[tool.flet.deep_linking]rendered the Android intent filter and iOSCFBundleURLTypesonly when bothschemeandhostwere set.schemeis now enough, andmyapp://…opens the app.android:hostonly if a host is set.--deep-linking-schemealone replaces the project's settings.pyproject.toml, andhttp/httpswithout a host, which would make the Android app offer itself for every web link.flutter_deeplinking_enabled(Android) andFlutterDeepLinkingEnabled(iOS) are dropped from the templates. They've been on by default since Flutter 3.27, and links still open the app without them on both platforms (see Testing).get_deep_linking_setting()) and the CLI handling are merged into oneget_deep_linking().Intent filters on the main activity:
[[tool.flet.android.activity.intent_filter]]This covers what the deep-linking setting can't: several schemes, hosts or paths, verified App Links, file types, share targets…
normalize_android_intent_filters(), so[tool.flet.android.receiver]filters also accept<data>and filter attributes now.VIEWwith a URL) arrive as routes. Other intents, such asSEND, need native handling.Fixes
[tool.flet.android.manifest_application]couldn't overridelabel,name,iconorenableOnBackInvokedCallback.flet buildwith the user's values on top, XML-escaped, and booleans written astrue/false. A product name containing&also broke the manifest before.[tool.flet.android.meta_data]values and[tool.flet.android.provider]attributes containing&,<or", such as a URL with a query string, made the manifest invalid. Every value in the manifest template is now escaped, including permission and feature names.Docs
publish/android.md: new Queries and Activity intent filters sections, and the Application attributes and Receivers sections are updated.FileProvider,INTERNET, the leanback/touchscreen features, thePROCESS_TEXTquery, the launcher filter and the four<application>defaults.<manifest>.<plist>/<dict>or<manifest>instead of loose<key>s. The deep-link filter is shown inside the main activity.publish/index.md):page.route;httpson iOS needs Universal Links;page.routeat startup and inon_route_change).Page.routeandPage.on_route_changemention deep links.Testing
Info.plistfor queries,<application>attributes, deep links, activity and receiver filters, and escaping. The existing deep-linking tests now callget_deep_linking().VIEW+telquery,can_launch_url("tel:123")isTrue;can_launch_url("sms:123")isFalse, although Google Messages handlessms:.manifest_application:label = "Queries & Co"withallowBackup = falsebuilds, andaaptreports the labelQueries & Co.fletprobe):fletprobe://pay/result?x=1givespage.route == "/result?x=1";on_route_changewith/second?y=2;https://example.com/invite/abcandfletprobe2://x/twomatch the app, andhttps://example.com/otherdoesn't, sopathPrefixapplies.autoVerify: kept in the merged manifest, andpm get-app-linkslistsexample.com.httpslink givespage.route == "/invite/abc?ref=1"./result?x=1, thenon_route_changewith/second?y=2, withoutFlutterDeepLinkingEnabled.Fixes #6560
Summary by Sourcery
Extend
flet buildto configure Android manifest visibility and intent handling while making mobile deep links more flexible and generated manifests valid.New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: