Welcome, Android extension devs!

Hello, Android extension developers!

My name is Simeon and I’ll be your friendly neighborhood developer advocate. I’m here to help you learn about building extensions targeting Firefox for Android. I’ll be answering your questions here, hosting office hours sessions where we can talk one-on-one, working on documentation, and generally aiming to help you build awesome stuff for users.

Good luck and happy coding!

Simeon Vincent
Developer Relations Engineer
Firefox Add-ons

2 Likes

Welcome Simeon!

I’ve seen you active in the Chrome extensions community for many years, are you sure you are not a spy stealing Firefox secrets here? :smiley:

(to prove otherwise, you must give us all Chrome secrets!)

Regarding the Android extensions support that should come soon, I have a single wish and maybe you can help push it :slight_smile:, the storage.sync support!
(what feature/API do you miss the most on Android?)

2 Likes

@dotproto I’d love to attend an office hour session. Are there any currently scheduled?

Haha, thanks for the welcome, @juraj.masiar. Alas, I’m not much of one for secrets. I tend to focus more on helping extension developers and figuring out how to improve the WebExtension platform. I’ll see what I can find out about storage.sync. Thanks for linking directly to the issue.

As for what I miss most on Android, to be honest I’m still finding my feet with building extensions on Android. I think the thing I miss most is screen space. I think one of the biggest challenges extension developers have is signaling to the user that they can do something useful without getting in the user’s way. That’s tricky on desktop, but it’s even more difficult on mobile.

Glad to hear you’re interested, @aconder. I actually just published an update on extensionworkshop.com for this. Head over to https://extensionworkshop.com/community/#office-hours and expand the “Book a session” section to schedule an appointment.

3 Likes

Hey! I’m the developer of Cookie-Editor.

I was wondering if there was any plans to support add-ons on Android tablet that would look just like on desktop and be able to use popup?

Also I’m not sure right now if it is possible, but is there any plan to allow optional host permission?

The popup “works”, but it’s opened as a “kind of tab” (full screen without URL bar).
But you get access to the currently opened tab with “activeTab” permission.

I agree on big tablets it would be nice to have actual popup window. Although it’s hard to say if it would fit since maximum popup size is 800x600px and that’s a lot of space even for tablets.

Hey…how long does it take to have an account verified?

Hi! @dotproto
I am working on an feature and
I want to make a apk for firefox-fenix with my extension installed,
I was able to run web-ext for nightly downloaded from the playstore.

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