Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding "default browser" inside Leon for quick "open" action #186

Closed
serrq opened this issue Jun 4, 2023 · 14 comments
Closed

Adding "default browser" inside Leon for quick "open" action #186

serrq opened this issue Jun 4, 2023 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@serrq
Copy link

serrq commented Jun 4, 2023

It needs of "exit browser" default setting. Because after I click the "open" button Leon must pass the cleaned URL to default browser.

@serrq serrq changed the title Adding "default browser" inside Leon for quick "open" button Adding "default browser" inside Leon for quick "open" action Jun 4, 2023
@svenjacobs
Copy link
Owner

Hello @serrq,

I don't quite understand your feature request. If you have multiple browser installed, when clicking the "open" button there should be a share dialog where you can select the desired browser. Usually you can select between "open once" or "open always" (making this browser the default). This is the standard behaviour of Android and does not have anything to do with Leon. On more modern Android OS versions there is a dedicated system setting for the default browser which Leon will stick to. Again, this is just the standard behaviour when sending an Intent to the system.

@svenjacobs svenjacobs added the question Further information is requested label Jun 4, 2023
@serrq
Copy link
Author

serrq commented Jun 4, 2023

As for the default from the OS for the system browser I chose Leon, so every time I click on a url Leon intervenes, and it places itself on "Do nothing" because I chose this action.

But when I click on "open" nothing happens despite I have three browsers installed.

Is it a bug or is it what you expect your app to do?

@svenjacobs
Copy link
Owner

Is it a bug or is it what you expect your app to do?

Interesting. This is a bug. I will have a look into it.

@svenjacobs svenjacobs added bug Something isn't working and removed question Further information is requested labels Jun 4, 2023
@svenjacobs svenjacobs self-assigned this Jun 4, 2023
@serrq
Copy link
Author

serrq commented Jun 4, 2023

Android 13
OnePlus CPH2399
Leon 28 (fdroid)

@serrq
Copy link
Author

serrq commented Jun 4, 2023

I think it’s a logical problem.

Let’s try to reason together: when the operating system asks me which browser I want it to be by default I choose Leon, but Leon never asked me which browser I want to match to the "open" button, so at most Leon can only call itself, because it is the default system browser (in my case).

Do you understand the problem where is it? Leon calls itself, instead it should ask me which browser I should use on the outgoing.

@svenjacobs
Copy link
Owner

Yes, I understand the problem. I just need to think about a solution 😉

@devnoname120
Copy link

devnoname120 commented Oct 10, 2023

Being able to set Leon as the default browser would be super convenient. Leon would immediately sanitize the URL and transfer the intent to the actual browser (chosen by the user).

@svenjacobs
Copy link
Owner

Hello all,

after thinking about this a bit more unfortunately I must say that this is not possible. Once Leon is set as the default browser, it's not possible to open another browser when clicking "Open". It is a (deliberate?) limitation of the Android operating system. Once a default browser is set, the system won't let you choose another browser when opening an URL, even if you explicitly ask to do so in code.

The only solution you have is to copy the cleaned URL and manually paste it into your browser. I'm sorry!

@svenjacobs svenjacobs closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2024
@devnoname120
Copy link

@svenjacobs Would it not work to call the chosen browser activity directly? Users could then either choose from a list of installed browsers (you can maintain a whitelist of known apps that are browsers), or manually write the full intent name.

@svenjacobs
Copy link
Owner

Would it not work to call the chosen browser activity directly? Users could then either choose from a list of installed browsers (you can maintain a whitelist of known apps that are browsers), or manually write the full intent name.

Querying for installed browsers is not possible as I have mentioned here.

I would have to maintain a list of known browser packages. I would have to keep this list up-to-date. I would have to manually query if one or more of these browsers are installed. I would also have to build my own chooser dialog to select the desired browser where the link should open. All in all I think this is a very fragile and high-maintenance solution 😞

@devnoname120
Copy link

@svenjacobs Would it work if the device is rooted?

@svenjacobs
Copy link
Owner

@svenjacobs Would it work if the device is rooted?

Maybe, I don't know.

@TPS
Copy link

TPS commented Nov 23, 2024

Querying for installed browsers is not possible as I have mentioned here.

I would have to maintain a list of known browser packages. I would have to keep this list up-to-date. I would have to manually query if one or more of these browsers are installed. I would also have to build my own chooser dialog to select the desired browser where the link should open. All in all I think this is a very fragile and high-maintenance solution 😞

@svenjacobs I believe this isn't correct. OLW does this very well, a certain bug notwithstanding.

@svenjacobs
Copy link
Owner

@svenjacobs I believe this isn't correct. OLW does this very well, a certain bug notwithstanding.

This is how they do it. The error in my case was that I used PackageManager.MATCH_DEFAULT_ONLY instead of PackageManager.MATCH_ALL 🤦🏼‍♂️ So I can query for installed browsers BUT this comment is still true. Even when using Intent.createChooser, we still don't see the system chooser and Android only opens the default browser. What OLW did is they built their own chooser dialog, which Leon would also have to do as I mentioned earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants