Welcome, Android extension devs!

I’m not aware of any specific plans for this. Could you create a feature request for Fenix (Firefox for Android) on https://bugzilla.mozilla.org/enter_bug.cgi?

Yep, optional_host_permissions is on the backlog for Firefox. This is being tracked in 1766026.

2 Likes

What kind of account verification are you asking about?

I’m not sure I understand. Are you looking to distribute your extension as part of your Android app, are you trying to crate alternate browser based on Firefox that includes your extension, or something else?

I’m not aware of any current plans to let Firefox install an extension that’s provided by another Android application. Extension installs need to either need to come from AMO or a self distribution option. At the moment Android only supports distribution through AMO.

Thank you very much for the reply!
I was trying to make BlockTube extension compatible with android,
I followed the steps mentioned in this doc

also added key in the browser_specific_setting, could you tell how can I make it work?

PS> The extension was working in desktop mode but failed in mobile mode

@Ayush_Chaudhary and I looked into this during an office hours session. It turned out that it was a bug in the extension’s content scripts match pattern. On desktop YouTube uses the domain https://www.youtube.com but on mobile they use https://m.youtube.com, so to cover both we used a match pattern of https://*.youtube.com/*.

Hey @dotproto, thanks for the reply.

I just tried my extension on Firefox nightly on android and it seems that if I am using Manifest v3, all “host_permissions” are treated as “optional” by default (just like on PC, like we discussed in this thread Porting Chrome add-on -> Firefox: page permissions not granted by default?)

However, it seems like there are no way to request for permission at run time. I am trying to do it like this:

window.browser.permissions.request({ origins: [url] });

I get no warning but also I don’t get any prompt to accept the request or any callback. It seems like manifest v3 addons are blocked by this.

EDIT: Nevermind, I just saw this was fixed in milestone 120 (as per https://bugzilla.mozilla.org/show_bug.cgi?id=1810047)

Where is the slide deck to the “Add-ons for Firefox Android - Everything you need to know!” stream from 2 days ago?

It hasn’t been posted yet. I’m following up on that today :slight_smile:

EDIT: The slides are now available at https://assets.mozilla.net/pdf/2023-10-12-addons-for-firefox-android.pdf. We’re also looking into getting the recordings updated to include that link.

Unfortunately, MV3 is out of scope on Android for now. We don’t currently have an estimate for when it might be supported, but I’m confident that it won’t land before the end of the year. We’ll share updates here and on the blog when we have more details.

Oh, I’m sad to hear about this.

My extension, using MV3, works really well on firefox nightly 120 now.

It may still work well on Firefox for Android, but unfortunately it will require a little more work to be compatible. Is your extension only targeting Firefox or are you also aiming to be compatible with Chrome(ium)?

If you’re only targeting Firefox, you may be able to make a couple small tweaks to your manifest to get Android compatibility:

  • Use "manifest_version": 2
  • Replace "background": { "service_worker": "FILE" } with "background": { "scripts": ["FILE"], persistent: false }
  • Move "host_permissions" entries into the "permissions" array.

From there, run web-ext lint or try loading it in Firefox to see if there are any other errors that need to be tweaked.

If you are targeting Chrome compatibility, you’ll likely want to set up a build step to create two different builds of your extensions. One version will use the current manifest.json and will be uploaded to Chrome’s store. The other version will use a new manifest.json as described above and be uploaded to AMO.

I’m not sure when this landed, but manifest v3 host permissions are working on Android in Firefox Beta (120) right now. The catch is that manually configuring (or viewing) permissions is not possible, the only way host permissions can be assigned is through a permission prompt, which works in 120 but not 119. So it doesn’t seem to be a showstopper anymore.

3 Likes

Awesome catch, @lordpipe! I’ll see if I can find out when that landed.

My MV3 addon, which used to work, stopped working in 116 and still doesn’t work in nightly 121.


It doesn’t specifically request permissions - I was able to grant them in the addons manager in the permissions tab. (On desktop I can grant when accessing one of the affected sites too.)
Is that functionality to be restored? If so what’s the bug number?
Or do I have to add a permissions request for the two sites affected, which I don’t have to do on desktop?

Is it possible to make dictionary-add-ons from https://addons.mozilla.org/en-US/firefox/language-tools/ available for Firefox for Android?

I’ll see if I can get some info on this, @Fjoerfoks.

Oh my God! I’ve been struggling with mv3 host permissions on Android for a long time. Thanks for sharing this way. It really saved my time.

@DaveRo, the link you included implies that you have a Manifest V3 extension. Host permissions are restricted by default in Manifest V3 and the UI to prompt the user for host permissions is not finished on Android. Unfortunately, without more information about what your extension is doing or what problems you’re seeing in the browser it’s hard to provide more guidance. Can you share the URL of your extension?

@dotproto Hi. The link to the addon is in the bug report. I’m aware of MV3 host-permission limitations.

It’s been updated since then to meet the new android-compatibility requirement.

Appreciating your great work