Android doze mode interrupts WebRTC call - android

When de app is in the background for a while (usually about half an hour) the connection is broken. The logs do not show anything, even while I have created a partial wake lock and put the app on the Doze whitelist.
This causes the media flow to be stopped, which is not something we want to have. Since the called side then receives a hangup message, but the app does not, the media just stops flowing.
While trying to debug this, I also note that logcat is disconnected after a while (might be a android studio on mac issue. Have had more problem with this). So debugging this is very difficult.

Related

Audio Call Stops working when Android App goes in Background and device is on Battery Saver Mode

My question is more like client side.
I am using Janus AudioBridge Room to make audio call.
Android app works fine in foreground and background mode if device is not on Batter saver mode.
But when device is in Battery saver mode. App gets hold while getting into background.
When we gets back to the app. Call rejoins from there. But if it gets long enough to call 'Keepalive' event. Then app will stops or crash.
I handle this by getting this android permission explicitly from user.
"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"
Then in battery saver mode. our call does not affects. as our app now can work on background in battery saver mode also.
I don't think this is the best way to do that.
I checked Whatsapp permissions. They are not asking for it.
What Whatsapp or other calling applications are doing to do this in a more proficient way?
Any guide and Clue will be helpful. I appreciate

How can I keep a BLE app alive all the time?

I'm trying to connect an App to a custom system with BLE that I added to my dog's door, which allows me to open/close it remotely as well as to know when is open "illegally" so it reproduce an alarm in my phone.
I've added the BLE class to the Main Activity and manage it from there, using fragments to see the data and sending commands.
But the problem I'm having is that, after some time, the App just close itself, breaking the BLE connection so I can't receive updates in "real time".
I don't know if is possible that the system don't kill the App, I've hear about services and that they keep the connection alive, but I'm not sure if they respect the other parts of the App or if the App get killed but the service don't. I've never worked with services before.
I've added the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission and also disabled the memory optimization as well but it still get killed.
When the app is killed and I press the App icon to open it, it looks like a fresh start and it should be keep alive all the time. Otherwise I will have "security issues" if something happens while I'm not connected.

Chromecast connection lost after screen lock

I have integrated the latest cast SDK within my Android application. It does play media correctly and I'm able to control the playback via on-screen controls as well as via the status bar notification and lock-screen.
I have received, though, reports from some users saying that after a while listening to the media via cast, when their devices went to sleep/got locked, they were not in sync with the receiver anymore as well as losing the possibility of controlling the playback.
I was not able to consistently reproduce the issue (since forcefully locking the device keeps the connection for a while), but I could see it happening a number of times and was able to catch logs for one of them.
At first, I was suspecting that the receiver's messages were not arriving to the sender (android app), but the Google Home application works flawlessly and updates the metadata and playback controls correctly. So, the pain point must be in my application.
I did notice that, while in that "inconsistent state", I am still able to read logs after a track finishes (so, change of state) as follows:
02-05 00:02:08.958 16642-27384/? W/CastDeviceController: [controller-0335 API] Ignoring message. Namespace 'urn:x-cast:com.google.cast.media' has not been registered.
Do I need to register that protocol within my application? (I do use a custom protocol to send messages - and if I'm not mistaken, the "unregistered protocol" is the default one - shouldn't it be automatically registered?). If so, how can I perform that registration?
Any help will be appreciated.

android phonegap timer in service plugin stops when device sleeps unplugged

the last couple of days i was busy getting a service up and running for an phone gap application (using the eclipse ide with the device (motorola defy android 2.3.) connected to my computer)/ the service runs in the background when the application is off and has a timer scheduled that passes an intent to launch my application at irregular times/ everything is working as intended/ when the application is off and the device sleeps (screen is black) the timer is still running and at the scheduled time the device gets woken up, the lock removed and the app starts/ however, the bummer came when i unplugged my device from my computer/ the timer seems to work only reliable in sleepmode when the device is connected to my computer/ when its not connected to my computer the timer only fires correctly when the screen is on/ when it is not on it fires unpredictable at will and more often not at all/ i switched off the option that the device should not go in deep sleep when charging/ but it still works when the device is either connected to a power outlet or computer
can anyone try to explain what the reason might be?
is there anything i can do to make sure the timer is running as is should unplugged while the device is sleeping
Sorry my bad, it doesn't FULLY answer your question
One way is to register for ACTION_SCREEN_OFF and ACTION_SCREEN_ON event at the native level and propagate that event to phonegap layer (# html/js level).
More details on handling Screen Off and On intent click here.
More on how to Notify UI layer click here.

Does android keep a log of when it starts?

I'm making a parental control/accountability app for android. It consists of a monitoring service that runs in the background and starts when the phone is booted.
Unfortunately, I have found that when android is started in "Safe Mode", services are not started automatically, and because of this my app has a serious flaw.
While in safe mode, the web and other apps can be started without my monitoring service running.
I thought that if it isn't possible to monitor app activity while in safe mode, maybe I could at least have my app detect if the phone was previously in safe mode. Then it could maybe alert the parent or accountability partner?
Does Android keep any log of this? Or any boot log in general?

Categories

Resources