React native audio call voice disconnects when app in background in Android - android

I have created a calling application group/p2p using peerjs in react native. Everything works fine when app is in foreground. But if the scree black out due to proximity or screen lock and goes to background, voice is disconnecting after few seconds. Searched good and gone though the Android documentation for the solution. But could able to find any appropriate answers. Due to latest changes in Android 11, access of microphone & camera in background is limited. I don't know how to achieve this. Can someone please point me to right direction. I'm new to react native and mobile development. Thanks in advance for help.

Related

Can an app for Android process in the background, when the phone is locked? Built on React Native

Does anyone know if it is possible to build a native Android app on React Native, which would be able to run and process in the background - even if the phone was locked?
If, for example, a Recorder was initiated and the phone locked, could you program in gestures? Eg voice triggers or tapping the volume button to action something?
Many thanks in advance for any advice!
Built an audio recorder app in React Native although it would stop after about 5 minutes.
We want an app which would run in the background listening for triggers (voice or touch) to then action something.
It doesn't matter if the app is in React Native or actual Native here, the answer is mostly no. When the screen is off, it goes into Doze mode- a power saving mode. When in Doze apps get very limited processing time- a window every 15 minutes or so.
The power button definitely wouldn't be doable. With the screen off, you aren't the foreground app and wouldn't get button notifications, even if you were the foreground screen when it was shut off. Voice triggers could be possible, if your app was whitelisted from Doze (which can't be done programatically), but realistically isn't going to work well and would kill the battery. And even if you can it would be FAR easier to do natively, as ReactNative only really works well for UI integrations. Deeper interactions with the OS require either a lot of native modules and workarounds, or are simply impossible due to the threading model not working.

How to I keep android from not disconnecting from a call when phone is locked in react native

I am trying to make a clubhouse like app using react native and it seems like when I'm on call with someone but im an "audience" (no sound) I get disconnected and kick out of the call when my phone is locked. Seems like this is an issue with just android. (It works fine with ios). I'm not too sure if it's an agora thing or an android thing. Any help woudl be appreciated.

Prevent Android from closing a Progressive Web App playing audio in the background

I've written a progressive web app which plays music using the Web Audio API. A common user journey is to start the music playing, then change to other apps whilst still listening to the music. This works fine for a while, until android decides that it needs more resources for the other apps and closes down my PWA without warning.
Is there a way to hint to the browser and OS that despite not being in the foreground, the user is still using a particular web app?
I'm fine for it to be tidied up in the background when the music is paused, but not whilst the user is still listening to something.
The main browser I'm interested in is Chrome for Android (though something platform agnostic would be ideal).
You can't, today. This is somewhat related to MediaSessions (https://wicg.github.io/mediasession/), but you really need a background app, which is not a concept that's yet supported by the web. (It's related, also, to ServiceWorkers and Web Workers, but again, not precisely. It's really a difficult scenario, as such an app has a definite ability to drain batteries.)
I have created a bug for this Chrome bug
If you have steps to reproduce, please comment on the bug

Event Based react native background

Is it possible to implement an event based background service that runs when the app has been left? I am planning to use react-native and their implementation of geolocation. The device will be an Android Phone. It would be a plus if the same goals can be made available on iOS too. I have heard that iOS have strict guidelines of GPS running in background service when user has left the active app state.
EDIT: Further research shows that I may be able to implement this with cordova plugin. Although I have no experience with working with this plugin before.

Intel XDK HTML Android app, run in background?

So I've created a 'Sound App' that needs to run when the phone is locked.. After a minute of being locked the sound just cuts out. Anyone suggest a fix?
The app is created out of basic HTML5, css & js. Audio needs to continue playing when the phone is locked.
Thanks in advance! :D
You'll need to use a plugin that provides a background service. In order to preserve battery, mobile devices do not normally allow applications to continue to run once they lose focus. After a short period of time they are paused, and if RAM is required to run other apps, they might be stopped entirely. See the pause/resume events for a little more info: http://cordova.apache.org/docs/en/3.5.0/cordova_events_events.md.html#pause
Here's a project from devgeeks, who is an accomplished Cordova developer, regarding background audio on iOS: https://github.com/devgeeks/ExampleHTML5AudioStreaming -- also, this blog by Andrew Trice may be of value, he is also an experienced Cordova developer: http://www.tricedesigns.com/2012/01/25/low-latency-polyphonic-audio-in-phonegap
You might want to search for "cordova phonegap app background audio" for more solutions.

Categories

Resources