Listen to websocket on background - android

I'm currently working on a project using Cordova and the ionic framework. It will be available on iOs and Android.
I want to implement websockets on the project (the server-side is already done), and I basically know how to do that for the writting, but I'd like it to read, 'listen', on the websockets also when the app is not on foreground.
From what i saw in my researchs, I guess I will have to implement background services in both languages (Java and Swift), but if it's possible to avoid that....
The main problem is I don't really know where to start and my researchs didn't lead to a lot of results.
Thanks
EDIT: to be more precise, the part of the app that will use websockets is a chat, and I'd like to continue sending notifications when a message is received, even if the app is not on foreground.

Related

how to make an app that automate rideshare/restaurants app requests (ex. mystro)

does anyone have any idea how to make an app that automates and filter rideshare/restaurant apps requests? It's kinda working as an umbrella for more than one app.
for example, the XYZ app will be in the foreground and will monitor both Uber Eats and Postmate in the background and whenever requests are received it will show on the XYZ app screen with its details.
I believe it's not doable on the IOS but its existing on android on an app called Mystor. it uses somehow advisability functions in the phone but I want to understand the logic behind it and know how does it work?

Android background worker

I need to create service for React-Native application that is able to receive push notifications from the server even when the app is closed.
I tried using FCM and it's working great, but I need to make it work without using the third party like FCM.. it needs to be self-hosted service.
I didn't find any package or solution to do so in React-Native so I decided to try to make a native module about that and then add it in my React-Native.
Can anyone tell me where to start - how to create a background listener in Java so it can listen for server requests even if the app is closed?
I am a few months into React-Native and totally new to Native Android development so any kind of advice is appreciated.

Nativescript application running on background automatically open in foreground

I have a nativescritp app, which receive phone calls.
When the app is not running on foreground, it still receives the calls, which is fine.
What I need to do is to "load" / "run" / "show" the application on the screen, so the user can answer the phone call or decline it.
It may not be quite straight forward as building an app and there are no ready made plugins available to achieve this.
For iOS you will have to implement CallKit and for Android you will have follow the set of procedures explained here.
FYI, with iOS your normal code won't run any longer if app is minimised. With Android you will have to implement the android.telecom.ConnectionService as explained in the link above, refer onShowIncomingCallUi() for showcasing UI for the call.
If you are not proficient with marshalling native code (iOS & Android) then I would suggest you to start there.

Integrate Android Service on NativeScript App

I need to develop an app that should periodically check for available WiFi networks and trigger an action once an specific network is on range.
I plan to implement an Android service to handle the part on which it keeps checking for the available networks and make it broadcast a notification once the specific network is detected.
I'm wondering how to integrate that on a NativeScript App, what I mean is that I want to make the code on NativeScript subscribe to receive the notifications from the Android Service, and once it is received do something.
To be clear, I want the Service to be native (written on java) and somehow get it included on my NativeScript app, to make it interact with the GUI.
Thanks,
Well, it seems like there is quite a few resources regarding this subject:
mainly:
https://github.com/NativeScript/sample-android-background-services
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
this might be useful (if you happen to have an error mentioning 'empty constructor'):
https://www.npmjs.com/package/nativescript-android-utils
you might be also interested in using web workers:
http://docs.nativescript.org/core-concepts/multithreading-model#multithreading-model
or extending an existing android app:
http://docs.nativescript.org/integration-with-existing-ios-and-android-apps/extend-existing-android-app

cordova android background process

I'm currently trying to make a cordova app for android.
The end goal is to make an app that will unlock a door when the phone come near it. To achieve this, I believe that I need to setup a custom plugins that will handle the interaction with the door.
So far I got the basic of the application. I got the cordova interface with a bluetooth plugin that let me detect the door(in my case any bluetooth device that emulate it), I can stock the bluetooth ID in the local storage. I'm able to connect to it and send/receive data.
What I need to know, is how can I declare a background service that will be wake up by the system, that doesn't involve the UI nor the mainActivity (since I don't have access to it with cordova)
I'm not sure how must I declare the service, how must I register it so that the system will know it must not wake up the app (because the cordova core will do nothing with it) but only the plugin class that will by able to handle it.
I was looking at android beacon library but I didn't know how to integrate it in a plugin since they register the thing in the main class of the application in the onCreate (I don't think I have access to that in cordova)
Any help would be really helpfull. Thank in advance!

Categories

Resources