Open bsutton opened 5 days ago
So rather than trying to enter the schema into the address bar I created a test html page:
<html>
<body>
<h1>Deep link below</h1>
<a href="hmb:/xero/auth_callback">Click me to launch hmb</a>
</body>
</html>
This successfully launched my app however the applink listen isn't being called:
In my main I have:
void main(List<String> args) async {
if (args.isNotEmpty) {
print('Got a link $args');
} else {
print('no args');
}
WidgetsFlutterBinding.ensureInitialized();
// await TimeMachine.initialize({'rootBundle': rootBundle});
// final tzdb = await DateTimeZoneProviders.tzdb;
// final currentTimeZone = await FlutterNativeTimezone.getLocalTimezone();
// // log.info('Loading current timezone of [$currentTimeZone]');
// await tzdb[currentTimeZone];
/// Implement deep linking
final _appLinks = AppLinks(); // AppLinks is singleton
// Subscribe to all events (initial link and further)
_appLinks.uriLinkStream.listen((uri) {
print('Hi from app link');
HMBToast.notice(navigatorKey.currentContext!, 'Got a link $uri');
if (uri.path == ('/xero/auth_callback')) {
HMBToast.notice(navigatorKey.currentContext!, 'Some asked for xero');
}
});
runApp(const MyApp());
Just in case my problems was around using a debug build I switch to launching a compiled version of my flutter app.
When I launch the app a second time, the second app doesn't launch (or rather I suspect it launches then immediately shuts down), however I can see that the focus returns to the first instance of the app,
What clearly doesn't happen is that the applink listener doesn't fire (I can see in the terminal window that I get xdg-open to launch the app via - and the print('Hi from app link'); isn't output.
Here is my current .desktop:
[Desktop Entry]
Name==Hold My Beer - I'm a handyman.
Comment=Launch Hold My Beer with deep linking URL
Path=/home/bsutton/git/handyman/handyman
#; Exec=flutter run --start-paused -d linux /home/bsutton/git/handyman/handyman/lib/main.dart || read -n1
#; Exec=gnome-terminal -e "bash -c 'flutter run --start-paused -d linux /home/bsutton/git/handyman/handyman/lib/main.dart;$SHELL'"
Exec=gnome-terminal -e "bash -c '/home/bsutton/git/handyman/handyman/build/linux/x64/release/bundle/handyman;$SHELL'"
Icon=web-browser
Terminal=true
Type=Application
Categories=Network;WebBrowser;
MimeType=x-scheme-handler/hmb;
I don't have linux so I'm blind to help you here. But there's a new version 6.1.2 with dedicated package to linux platform that has just been released. It may worth a try.
Describe the bug
I'm trying to use app_link (6.1.1) to launch my flutter app when a user access a custom schema in chrome.
I've successfully added a .desktop file and registered a mime type.
xdg-mime reports:
xdg-open correctly launches my app.
The problem is that when I enter hmb://test into the chrome address bar it does a search rather than launching my app.
Does it related to [x] linux deep link (?) [ ] App Links (Android)
[ ] Deep Links (Android)
[ ] Universal Links (iOS)
[ ] or Custom URL schemes? (iOS)
Does the example project work?
[ ] Yes
[ ] No
[x ] Irrelevant here
Did you fully read the instructions for the targeted platform before submitting this issue?
The instruction for linux are rather short on detail.
Uploaded your files to webserver, HTTPS, direct connection, scheme pattern setup, ...
[ ] Yes
[ ] No
[ ] Irrelevant here