How to prevent the program from being unloaded from memory?

Just starting out? Need help? Post your questions and find answers here.
AZJIO
Posts: 73
Joined: Wed Dec 14, 2022 1:13 pm

How to prevent the program from being unloaded from memory?

Post by AZJIO »

My alarm program is being unloaded from memory despite the fact that I have enabled running in the background. During the test, without closing the program window, I left it waiting for the alarm, an hour later the alarm went off. If I minimize the program with the button in the form of a circle on the phone, then after a while it is unloaded from memory. This is clear from the splash screen at startup, because if it is not unloaded, it opens instantly without a splash screen image. When testing the alarm after 3 hours, it no longer worked.
How to make the program work in the background fully without being unloaded from memory?

My friend also checked and his program is also unloaded from memory on the 10th version of Android.
plouf
Posts: 196
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: How to prevent the program from being unloaded from memory?

Post by plouf »

So your alarm program is a android app and not a web based one, this info is crucial to specify.

Some of the stuff you want is impossible with pure spider commands, you have to dig to cordova plugins for most of these.

Anyway i DONT KNOW if it help but in android(and ios) you can specify for each app from configuration of OS , to NOT use battery optimization/economy and some, OS versions, also have an option "allow to run in background" try enable these to see if help.
I would interest to know if it worked or not ;-)
Christos
Dirk Geppert
Posts: 284
Joined: Fri Sep 22, 2017 7:02 am

Re: How to prevent the program from being unloaded from memory?

Post by Dirk Geppert »

I would also recommend looking for Cordova plugins that allow background operation.
Another untested idea would be to try a ServiceWorker?
AZJIO
Posts: 73
Joined: Wed Dec 14, 2022 1:13 pm

Re: How to prevent the program from being unloaded from memory?

Post by AZJIO »

I post the program here.
There is also a permanent link on Yandex and a temporary link on the upload.ee server.
Source included.

I have known about the background process for a long time, and recently I learned about what should be enabled in the power saving settings, since the "Sliding schedule" program with the "31" icon during installation shows what needs to be done so that there are no problems. All this I know. I have android version 5.1, my friend has 10. This is not the first time I have tested and eliminated a bunch of shortcomings, the last of which was a timer that had a low priority, and when polling time, delays appeared and shifted the timer by 20%. That is, if there are 48 hours before the timer, then it will work in 60 hours. I made requests to synchronize the time. Now the obvious problem is unloading from memory. I haven't tried leaving the program on before going to bed yet. If it helps, this is at least not ideal, but a possible option for the alarm clock to work. Ideally, I would like not to know about the existence of the program, and it would do its own thing. Installed and forgotten, and not tell the user how to work with it. to be reliable.
User avatar
Paul
Posts: 197
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: How to prevent the program from being unloaded from memory?

Post by Paul »

I don't see any options in SpiderBasic to create Foreground Services, which I think you would need to accomplish what you want.
tj1010
Posts: 201
Joined: Wed May 27, 2015 1:36 pm
Contact:

Re: How to prevent the program from being unloaded from memory?

Post by tj1010 »

All my programs retain state while background and background-while-locked in Android 13 and 12. I have no battery optimization suspend stuff set, though... S21 5G and A10 test devices for reference.

Battery and device care>Battery>Power saving
Battery and device care>Battery>Background usage limits

Those are the only native put-to-sleep setting menus on AOSP and Samsung AOSP. "Never sleeping apps" may be of interest..

My 13 phone has "Put unused apps to sleep" and "Limit apps and Home screen" on and my apps are retaining UI and data state through being locked... I handle no types of service or admin API stuff... AOSP *DOES* have optimization stuff not exposed in settings, but it's light weight(it takes extreme inactivity to trigger) sleep-store state stuff in ART and Dalvik(Doze and App Standby)..
AZJIO
Posts: 73
Joined: Wed Dec 14, 2022 1:13 pm

Re: How to prevent the program from being unloaded from memory?

Post by AZJIO »

I left the program window open and the alarm worked successfully after 5 hours. Program updated.
tj1010
Posts: 201
Joined: Wed May 27, 2015 1:36 pm
Contact:

Re: How to prevent the program from being unloaded from memory?

Post by tj1010 »

5 hours it's likely Doze. Never Sleep setting will work there. Something like setAndAllowWhileIdle() through API is needed for non-user action.

When I finish non-cors http I'll being doing this and tpm-keystore stuff and posting it
Post Reply