Search code examples
androidalarmmanager

Alarm Manager doesn't fire any alarm on flyme os (meizu)


First of all alarms fires well on other devices. Problem is exactly in FlymeOS (it's battery optimization, security features or something like that).

Second I've tried different alarms setRepeating(), setExact(), setExactAndAllowWhileIdle() with understanding difference between them. Result - again works well everywhere except meizu devices.

So how can I make these alarms fire on meizu?


Solution

  • The problem is in background processes restrictions on meizu. There are 3 running in background modes: "Allow running in background", "Smart background" (this is the root of your problem) and "Disallow running in background". So second is set for every app by default and so alarm will fire only is app launched right now, otherwise not.

    To fix your problem "Allow running in background" should be set. But you can not do it programmatically, so user should change this setting himself. All you can do is to open meizu security page for your application and call user to change this setting to "Allow running in background":

        Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.putExtra("packageName", BuildConfig.APPLICATION_ID);
    

    Running in background mode menu