Is "non-persistent" background script mandatory for Android?

Or is the only mandatory thing for the Android the browser_specific_settings/gecko_android key in the manifest?

I’m asking because my background script (although persistent in Firefox) is ready to be killed/restarted any time since I’ve upgraded it to support Chrome MV3.

But I don’t want to make it non-persistent if I don’t have to, since it will be waking up with each page load (for each opened page it needs to check whether it should inject highlighting script).

1 Like

Hey there @juraj.masiar, the below is from minds that know better than me!

Thanks – Ed

On Android we have made the effort to allow the continued use of persistent background pages. However this has a large caveat that extension developers should be aware of. Android enforces a process life cycle on background processes. Android can and does kill the extension process when it determines it needs to free resources, we have no control over this in Firefox. The result is that when Android kills the extension process, we treat persistent background scripts like event pages (non-persistent background scripts) as a best attempt to allow the restart of the add-on background. For many add-ons this will work well enough, however we strongly urge add-on developers to make the move to event pages. By making this move, we expect developers would identify any potential problems their add-on may have when being restarted after Android kills the extension process. It may also help identify any performance issues during the startup of their background script.

1 Like