Skip to content

Mozilla VPN Android on android will disable itself without a warning after a couple of hours #10702

@im7mortal

Description

@im7mortal

Describe the bug
Mozilla VPN on android will disable itself without a warning after a couple of hours

VPN version:
latest

Affected Platforms:
Android

Prerequisites:
Android probably after API 28 ?

Steps to reproduce:

Expected result:
VPN works

Actual result:
Mozilla VPN on android will disable itself without a warning after a couple of hours

Additional notes:

I had this issue for years. I had problems with Threema recently, which gave me the idea of how to resolve this issue. I did research and found that other people had this problem and were disappointed 3 years back: https://www.reddit.com/r/firefox/comments/10tk7b9/why_so_many_issues_with_mozilla_vpn/ (I attached a screenshot).

So Threema messenger does not use the Google Notification system. Instead, they always need to keep a background polling process. What happened is that the new version of Android could put this process to sleep for battery optimization. Threema is aware of it, so they actively warn users when this setting is active.

So I checked the battery settings for Mozilla VPN, and it was set to "Optimized". So Android put the app to sleep after some time (?). I changed it to "Unrestricted", and I finally had the VPN running for 33 hours without disconnection.

AI told me this Android API can give a tip about which regime is set for the app

PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
boolean isIgnoringOptimizations = pm.isIgnoringBatteryOptimizations(context.getPackageName());


Image
video_2025-08-01_21-51-48.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions