Page 1 of 1

Make lightning persistent

Posted: Mon Feb 18, 2019 7:12 pm
by Cueball666uk
Hey Guys and girls, Does anyone have a way to keep lightning launcher in foreground as I have disabled all battery optimisations and checked any other settings which could have caused any issues but lightning still sometimes does not show on first unlocking and I have to press home button to load it again... Any info would be awesome thanks

Re: Make lightning persistent

Posted: Mon Feb 18, 2019 7:18 pm
by JayM
settings/lightning/general/keep lightning running

tried this^

Re: Make lightning persistent

Posted: Mon Feb 18, 2019 7:22 pm
by Cueball666uk
Yep ... Already on .. still happens tho... thanks anyway ☺️

Re: Make lightning persistent

Posted: Mon Feb 18, 2019 8:50 pm
by JayM
only other thing I can think of is maybe you have don't keep activities switched on in developer settings.

Re: Make lightning persistent

Posted: Mon Feb 18, 2019 9:56 pm
by TrianguloY
No, I'm afraid the issue is real and not a user wrong setting. It is a lot more noticeable on Oreo and above, where the system just loves to kill lighting (and other useful apps in general too) when in low ram.
Android tries to reduce power consumption, but instead of focusing on optimizing the resources (to be fair they also do that) the best idea they had was to directly 'turn off' the device when you are not using it (all the new restrictions, some less features app-side, less wakeups, delayed notifications...).
I don't think this has an easy solution :(

Re: Make lightning persistent

Posted: Tue Feb 19, 2019 12:23 pm
by Cueball666uk
I could understand the memory issue more if I wasn't using a 8gb Oneplus 5T. Maybe it's just Oneplus trying to force the use of Oneplus launcher in some strange way ?

Re: Make lightning persistent

Posted: Tue Feb 19, 2019 3:01 pm
by TrianguloY
I don't think it is OnePlus trying to use its launcher, but it is highly probable that the OnePlus launcher is set to 'not kill' internally by the modified system.
And about having 8GB (wow) or 2, I don't think that is different. Yes, you can have more apps, but android loves having the ram full and used whatever their size, so when it needs to choose apps and processes to kill and make space for others...their decision is not always a good one.

Did you tried with other launchers other than the stock one? Are they killed too? A possible workaround is to try to simplify your desktop, mainly remove widgets. This will make lightning use less ram, and so less likely to be killed.

Another workaround is the typical 'this app is running in the background' notification a lot of apps were forced to use. Lightning doesn't implement this, but I think a script...hmm. I'll try something

Re: Make lightning persistent

Posted: Tue Feb 19, 2019 4:32 pm
by F43nd1r
Have you tried turning off battery optimization for LL?

Re: Make lightning persistent

Posted: Tue Feb 19, 2019 4:45 pm
by JayM
I know some launchers like smart launcher has like a plugin app that you can use if you can't set the launcher as home. I never needed it when I used that launcher but maybe something like that's needed for certain devices.

Re: Make lightning persistent

Posted: Tue Feb 19, 2019 5:02 pm
by Cueball666uk
I have already turned off any and all battery optimizations that are available ... So I'm hopeful on a possible script fix 🀞thanks peeps πŸ™‚

Re: Make lightning persistent

Posted: Wed Feb 20, 2019 3:31 pm
by TrianguloY
Not so good news.
The idea I had was to use a notification to 'force' android to keep the launcher loaded. It appears there is a special notification that can be shown to keep services active (this is the notification a lot of background apps show) but there isn't any for normal apps. This can be used to keep the floating desktop though, perhaps it is worth checking.

I tried to simply make a normal ongoing notification, but I'm not sure it works (for me it seems it doesn't close as much as before, but it can be just a coincidence or a false sensation).
This is the script in case someone want to try it, just run it once and optionally hide the notification. If it works, set it in the loaded event to run automatically when the launcher restarts, but as I said I don't think this is a solution.

Code: Select all

//bind classes
bindClass("android.app.Notification");
bindClass("android.app.NotificationManager");
bindClass("android.app.NotificationChannel");
bindClass("android.R");



//vars
var cntx=getBackgroundScreen().getContext();//if you need a 'context' for a java function, this is something you can use.
var nm=cntx.getSystemService(cntx.NOTIFICATION_SERVICE);//returns the service used to work with notifications
var id="nokill";


if(false){
//delete channel and exit
nm.deleteNotificationChannel(id);
return;
}

//oreo
nm.createNotificationChannel(new NotificationChannel(id,"Avoid being killed",NotificationManager.IMPORTANCE_LOW));


//create the notification from a builder
var n=Notification.Builder(cntx,id)//start the builder
.setContentTitle("Lightning is running")//title
.setContentText("Notification used to avoid lightning being killed. You can disable this notification channel to hide the notification")//main text
.setSmallIcon(R.color.transparent)
.setOngoing(true)
.build();//finish the builder and returns a ready notification


nm.notify(0,n);//show the notification. If you want to show more than one you need to set a different first number for each

Re: Make lightning persistent

Posted: Tue Feb 26, 2019 4:48 pm
by Cueball666uk
This seems to have very little effect ... Maybe it's just a placebo, thanks so much for the effort ... The only way I can be sure that lightning loads reliably is using tasker to re-open each time I unlock.. this has the unwanted side effect of closing whichever app I was previously using but I can deal with this until someone has a better idea ! Thanks for the effort tho .. it's much appreciated πŸ™‚

(Just a side note but niether nova or action have the same issue)