Closed jvandenbroek closed 2 years ago
I'll take a look after a few days when I'm back at "office".
Question: why can't you use tasker to quit baresip when you don't need any accounts being registered and then start it again when you need registered accounts?
Partial wakelock prevents Android from killing baresip foreground service when the device is in doze mode. So it does not sound like a good idea to release the lock except when baresip app is terminated at Quit.
Question: why can't you use tasker to quit baresip when you don't need any accounts being registered and then start it again when you need registered accounts?
That would be fine for me, yes. Maybe an intent for launching and stopping baresip could be implemented? Afaik it's only possible to start apps in foreground with Tasker. There is an option to kill an app, but that works best with rooted devices (which I have, so in my case will probably work fine, but maybe others would like this as well). I have other apps that react on a start / stop intents, so it should be possible to register some kind of listener without the app being started.
I'll test the Tasker start/kill action next days, if that works fine I'll let you know.
Well I think the launch / kill app works fine for me after testing a few days, seems to be reliable. Guess you're right, no need to change the wakelock behaviour.
Should I still add intent action for quiting bare sip?
I am not trying to use baresip with Easer, but I think you should. Adnroid norms are that an app which is not doing anything should not use power, and since baresip isn't like that every reasonable mechanism to get it to stop should be available.
Greg Troxel writes:
I am not trying to use baresip with Easer, but I think you should. Adnroid norms are that an app which is not doing anything should not use power, and since baresip isn't like that every reasonable mechanism to get it to stop should be available.
Even if no accounts register, baresip is still listening for incoming requests at all enabled interfaces.
A fair point about listening for local calls. Still, that argues for making it easy to shut down by all reasonable mechanisms.
Greg Troxel writes:
A fair point about listening for local calls. Still, that argues for making it easy to shut down by all reasonable mechanisms.
I checked and quit is implemented in MainActivity. It would be too much work to allow quiting baresip from intent receiver.
PR https://github.com/juha-h/baresip-studio/commit/52da111a716bf030d18534c09f1d6dec7a698397 added QUIT action to intent receiver.
After the very nice implementation of using intents to (un)register accounts (https://github.com/juha-h/baresip-studio/issues/257), I've noticed that the partial wakelock stays active after unregistering, which prevents the device to go to deep sleep and does drain the battery quite a bit. I would imagine there is no need for such wakelock when no accounts are registered.