After you use CreateProcess, you can create a Clock component and set a timer interval of your latency. When the event fires, do your work.
What you are trying to do might be theoretically possible, but is not recommended…
Usually you would use an alarmmanager to do something the next day… this does not require a persistent notification and does not need something running in the background, at the given time the alarmmanager will get triggered from the Android operating system…
Taifun
great, it worked fine! However background mode is still disabled when Redmi battery saver is enabled.
try to ignore battery optimization
Taifun
I tried! However your Alarm Manager also gets disabled when Redmi’s battery saver is enabled. Even after I disabled battery saver, Alarm Manager still doesn’t work again.
yes, some device manufacturers make it more difficult for us…
see also https://dontkillmyapp.com
Taifun
App Settings → Battery Optimisations → Do not optimise battery
I have set all app priorities related to battery saver and battery optimization. However, when the device automatically turns on battery saving, background applications still do not work and seem to be completely turned off.
Never heard of it, but I know that Xiaomi devices are known to make things not work in background to “save” battery.
You may also do this
App Settings → AutoStart → Enable Auto Start
Thank you! It seems to have worked. Is there a way to create an additional block that requires AutoStart permission?
You cannot directly ask for the AutoStart permission, but you can check if the user has enabled it or not and redirect the user to that page. I had made a library a few years ago.
But never created an extension for it
Hi, I have a problem that when I turn on battery optimization mode, the device turns off the background mode in all applications, when I turn off battery optimization mode, the Itoo background mode also stops running. Is there a way to turn the background mode back on after turning off battery optimization mode?
I have set:
App Settings → AutoStart → Enable Auto Start
App Settings → Battery Optimisations → Do not optimise battery
However it still does not work.
Unfortunately you cannot work around such device specific restrictions
What does not work? The notification dosent appear? The notification appears for some time and disappears? What happens exactly?
I see that your primary objective is to make a trigger a work in background after specified amount of time. You may look at what Taifun’s Alarm Manager has to offer. Or you can sponsor an extension exactly suited to your needs.
Both the “RegisterEvent…procedure” and “CreateProcess procedure…” task blocks are destroyed and stopped.
The notification dosent appear?
Did you enable the permission?
Can you also shoe me yoiur blocks?
I have enabled all permissions.I have enabled all permissions. Below are some blocks I use to run in the background.
You should not use Create Task, it is to create very short duration background services, maximum upto an hour. So you cannot run very long tasks, it will be likely be killed by the system. Instead try to use Create Process or Alarm extension.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.