How to open web link in default browser Android in a cross-platform project? #16983
-
I've been trying to find the answer to this since two months now... I've tried a few of the answers which I can't remember all of them, but mostly...
They all work just fine on windows... All of this... but none work on Android... I've found one single post that says to use "intent", but that is Avalonia.Android, which I don't have access from the main project... I CAN use intent from the .Android project itself... but how would I call it then? is there a way to create a main function in the main project, then overwrite it in each platform's project? When I say it doesn't open on Android, I mean it doesn't do anything, I tap the button, it shows the animation indicating I pushed it, but that's it, no crash, no error, no nothing... The idea is for the webpage to open in whatever default browser the user has... which again, All of the options I tried work fine if I launch on Windows Desktop, but they do nothing on Android... I also found a lot of talk about this, but I was not able to understand the answers, as they never contained code, but they linked to different githubs with projects that I could not understand... most of them using some part of "MAUI.Essentials", which would be counter productive, as I intent this app to be also available for Linux, which I understand that MAUI does not support... So I would have to make a separated application just for linux... I'm very sorry if the answer is out there, English is not my first language, and I've been searching for at least two months now (while developing other parts of the application) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
This was solved:
If anyone thinks an example would be useful I'll add one. |
Beta Was this translation helpful? Give feedback.
This was solved:
IOpenWebPage
) in the main projectpublic static IOpenWebPage openWebPage;
(or however you called your Interface in step 1)Shared.openWebPage = new AndroidOpenWebPage()
orShared.openWebPage = new DesktopWebPage()
use the one that corresponds to the platform. (Shared
is the name of my class in the shared project, replace with whatever your class is called)If anyone thinks an example would be useful I'll add one.