Intel XDK HTML Android app, run in background? - android

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.

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.

React native audio call voice disconnects when app in background in 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.

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

Block exit on Ionic application ( PhoneGap / Cordova )

I have an application and I would like to block the exit of it to the people that doesn't know the application,
how can i do it?
I only found a function to block back button...
Thank you so much...
The closest thing I could find is called task locking or screen pinning on Android. It is only supported on Android Lollipop (5.0) or higher. The documentation has the following to say about this feature:
Android 5.0 introduces a new screen pinning API that lets you
temporarily restrict users from leaving your task or being interrupted
by notifications. This could be used, for example, if you are
developing an education app to support high stakes assessment
requirements on Android, or a single-purpose or kiosk application.
Once your app activates screen pinning, users cannot see
notifications, access other apps, or return to the home screen, until
your app exits the mode.
There are some other questions asked regarding task locking, which you can find here and here.
I have been able to find a Cordova plugin for this here, however it doesn't seem to be very active at this moment in time.
Unfortunately, I don't think that this will actually solve your problem. From what I have been able (or unable) to find, this just doesn't seem to be possible. I think it is similar to closing an app on iOS with code, it is simply not allowed by the developers of the operating system.

Adobe air app running on background

I have an droid as3 app that i need it to work on the device background, i know that the android os is lowering the fps to 4 when it's on background which is fine by me, but, if i leave my app open and close my phone after around 30 minutes the app gets terminated automatically. does someone knows if there is something to do to keep it alive untill the user stop it?
i undestand that there is something i can do such as using the
executeInBackground() function or something similar.
First thing I thought about was if there is a way to trigger a android service(to run on background) through Adobe air, and unfortunately adobe air cannot run as a service in the background or trigger a android service.
You may try to write an android service that runs things on background.
There is something I found here it may help you.

Categories

Resources