Event Based react native background - android

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.

Related

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.

Communication between cordova app and native app?

I am building a cordova app which will communicate with a device using BLE in background using https://github.com/don/cordova-plugin-ble-central
Here are the challenges I am facing :
I want this app to be kind of a service to be used by another native app i.e communication between cordova and native app. I assume both apps need to be opened in background or one of them in foreground for this to work. Is it possible? How?
This cordova app will be a separate apk. But is it possible that it can be a part of native app so that user only have to install the native app without installing the cordova app separately?
Such app which continuously scans for Bluetooth Low Energy (BLE) peripherals is eventually be cleared by mobile OS to conserve battery. Is there any way to have it opened in background all the time. I know in android you can disable battery optimizations for a particular app. But what about IOS?
Is it maintainable across different platforms(both IOS and android)? Or native implementation will be a better choice?

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.

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.

create location tracking app for Android: native or phonegap?

We need to create an app, which works for time tracking of the employees as well as location tracking.
We only want to program it for Android, but we don't have any Android skills.
Therefore phonegap came as a great alternative.
But there are several questions, to which I can't find a clear answer in the web.
If the phone is in standby mode, can the phonegap-app still send position data? Would this still be phonegap standard or do I need to use plugins?
the smartphones will be very simple and cheap. Is there a higher risk, that the phonegap application gets closed by Android to free memory then for a native app?
Alltogether, could it be recommend to invest the time to learn Android or would it be better to stay at our language JS?
It’s perfectly feasible to write a location tracking application using phonegap and have it a) work in a performant manner on low spec android phones and b) keep the app running in the background when the phone is in standby mode.
To keep the app running in the background on android, it’s necessary to acquire a partial wakelock (see android powermanager). In phonegap, you need to use a plugin to achieve this. On the plus side, there’s an existing phonegap plugin to do this. The downside is that in order to use a custom plugin, you will not be able to use the convenient phonegap build method to build your app, so will need to do the manual process via the Eclipse IDE, but this is not a great hassle to set up (see here).
In terms of your app getting closed because of android running out of memory, and also having it perform responsively on cheap, low spec devices, this won’t be a problem so long as you are careful to write your javascript code in an optimal way. I’ve implemented a location tracking app using phonegap which uses custom maps and in testing on older android devices including HTC Desire and HTC Wildfire, performance was acceptable and the partial wakelock worked - I had no problems with the app getting closed because of lack of memory.
I chose phonegap over native because I’m a web developer so Javascript is more convenient for me than having to start from scratch with Java and the android SDK, and also because I was able to use the same JS code base with appropriate plugins to produce the same app for iOS. Phonegap is able to access GPS hardware on the device and in testing outside I found the average accuracy to be between 4 to 8 metres depending on the device.
Hope this helps!

Categories

Resources