NeoApplications / Neo-Backup

backup manager for android
GNU Affero General Public License v3.0
2.51k stars 123 forks source link

[Bug] (?) Scheduled jobs not executed #663

Closed jochen-01 closed 1 year ago

jochen-01 commented 1 year ago

Description I have some backup jobs which shall be executed during the night when the phone is not used and connected with power outlet. These batch jobs are not executed. They are tested interactively with "start now" -- no problem.

Steps To Reproduce

  1. define batch job
  2. modify schedule to sometime when phone is not used
  3. make sure that battery optimization for Neo Backup is disabled

Expected behavior Nightly backup job should be executed

System Information(please complete the following information):

hg42 commented 1 year ago

try enabling useAlarmClock in NB / AdvancedPreferences / Developer Settings

jochen-01 commented 1 year ago

try enabling useAlarmClock in NB / AdvancedPreferences / Developer Settings

Will do. Have not tried it 'till now because of "don't change unless a developer tells you to!" I'll report if that helps (takes a few days).

hg42 commented 1 year ago

I don't really think it will help, but it could. depends on the reasons...

Basically, the methods are not very different (at least in current ROMs). Not sure about older Androids...

I guess it's an app killer (battery saver), if you didn't install it yourself, then it may be part of the ROM. The algorithm might act different if it sees an alarm clock bound to NB.

jochen-01 commented 1 year ago

I don't really think it will help, but it could. depends on the reasons...

Thank you, it helped.

I guess it's an app killer (battery saver), if you didn't install it yourself, then it may be part of the ROM. The algorithm might act different if it sees an alarm clock bound to NB.

I made sure to disable battery optimization for Neo Backup. But who knows what HTC did. Some other programs make sure not to get killed by displaying a notification. Seems to work, I never had problems with, eg. Tasker or KDE Connect.

The alarm clock eats valuable room in the crowded status bar.

hg42 commented 1 year ago

I didn't refer to the battery optimization, that is also asked for by NB. I meant the methods some manufacturers use to improve runtimes, allowing cheaper batteries while still advertising good runtimes. Usual tester don't test background processes.

The apps you mention do something all the time. Depending on the enabled features they are registered to several events.

NB registers only an alarm (which is something similar to an alarm clock, but without appearing as a clock), and then it does nothing.

I admit, I don't know, how it's actually handled by the system and this changed a lot along Android versions.

Especially, if the service needs to actually run (=started but sleeping) or if it would be started by the system if it does not run. This might be a difference between alarm and alarm clock (maybe only on older Androids).

Though, in newer Androids, I cannot see a difference and I think there are users with A8 where it works. I guess, your ROM is aggressive killing background processes.

You could also try useExactAlarm instead of useAlarmClock. This is basically like the default but demands a more accurate timing (the other may be delayed several minutes). With a little luck, your ROM doesn't kill such services, either. Would be interesting to know if it makes a difference.

I suggest to try this app: https://dontkillmyapp.com/ it might give you some hints E.g. on my realme X2 / rmx1993 / AOSP / A10 all dots are where they should and only drift a bit at the lower part (8 hours)

jochen-01 commented 1 year ago

Though, in newer Androids, I cannot see a difference and I think there are users with A8 where it works. I guess, your ROM is aggressive killing background processes.

"In newer Androids (...)". That gives me some hope. Until now, with Android 8, I am using Titanium Backup. In preparation of a change to Android 11 I had to look for something else: Neo Backup. If there are no problems with scheduled backup jobs it's o.k.

You could also try useExactAlarm instead of useAlarmClock. This is basically like the default but demands a more accurate timing (the other may be delayed several minutes). With a little luck, your ROM doesn't kill such services, either. Would be interesting to know if it makes a difference.

Thank you, will try.

I suggest to try this app: https://dontkillmyapp.com/ it might give you some hints E.g. on my realme X2 / rmx1993 / AOSP / A10 all dots are where they should and only drift a bit at the lower part (8 hours)

There HTC earned a golden cup. ;-)

jochen-01 commented 1 year ago

You could also try useExactAlarm instead of useAlarmClock. This is basically like the default but demands a more accurate timing (the other may be delayed several minutes). With a little luck, your ROM doesn't kill such services, either. Would be interesting to know if it makes a difference.

"useExactAlarm" works. Nothing killed, backup takes place at scheduled time. I hope that it does not keep the phone vom entering doze mode?

hg42 commented 1 year ago

nice to know, thanks for reporting

the docs say that exact alarm takes more battery. I think the mode when apps sleep a while and are awaken all together (might be called doze mode, but I see this confused with other methods) isn't used for NB then. But it shouldn't matter, because NB does nothing in the background. So I think you won't notice it. Doze mode is more affecting apps that do something all the time like reading sensors etc.

jochen-01 commented 1 year ago

Hey, I have to decide between two trade offs? ;-)

  1. Having an alarm clock icon in the message bar,
  2. having the battery drained faster. How can I see the amount of battery power used by this method? Is it reported as "used by Neo Backup"? Just to see if it matters.
hg42 commented 1 year ago

I guess, you will not see any impact... because of this:

But it shouldn't matter, because NB does nothing in the background

just enable one or the other and compare, or see if you can notice an enabled schedule at all (I guess not)

jochen-01 commented 1 year ago

Thank you, will do.

hg42 commented 1 year ago

Hey, I have to decide between two trade offs? ;-)

1. Having an alarm clock icon in the message bar,

2. having the battery drained faster.
   How can I see the amount of battery power used by this method? Is it reported as "used by Neo Backup"? Just to see if it matters.
  1. upgrade ROM
jochen-01 commented 1 year ago

3. upgrade ROM

:-) Sure. My decision to try Neo Backup is because of that. Planning to purchase a new phone I have to change over from Titanium Backup to a replacement. I think Neo Backup can be part of my next backup concept. The alarm issue is not a real problem. If I find out how to restore an app which is not installed I can check the final point.