cyb3rko / flashdim

Modern flashlight app with dim functionality on Android 13+
Apache License 2.0
456 stars 18 forks source link

Feature: Can you make context not close light when close screen #71

Open schollii opened 3 months ago

schollii commented 3 months ago

Awesome app! Small feature request:

Sometimes I need light on while I'm doing stuff with my hands like some reno in the house, so i turn off screen to save battery. But also, if I need to look something up via another pap, I don't need the light on while doing this so the context open works great there.

So would it be possible to have additional context option, if set then light remains on even while screen is off regardless of context setting?

jetlagg3d commented 3 months ago

So you'd like for it to turn off when leaving the app, but not when turning off your phone?

schollii commented 3 months ago

When turning off the screen (eg on my android device it is one of the side buttons} - the phone is still on just the screen is off.

cyb3rko commented 3 months ago

Hi @schollii,
thanks for your request.

I understand what you are looking for, but I would have to make some research wether the app can even detect when your screen turns off. What I suppose at the moment is that the app close and screen turn off are not separated events. But that's only a guess.

schollii commented 3 months ago

For sure. I think it does, something like this in onCreate(), not sure:

screenOffReceiver = new ScreenOffReceiver();
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
registerReceiver(screenOffReceiver, filter);

where ScreenOffReceiver extends BroadcastReceiver.