Android background worker - android

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.

Related

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

Is it possible to trigger a notification on Android from outside the JVM?

I know Go pretty well but I don't know Java or anything about Android. I have compiled a Go program and run it via command line on Android and ideally I would like to run it in the background and have it send me a notification using the official notification system without using a third party app.
Is this possible? Could it be done with some type of inter process communication?

How to run codes after the Ionic App has exited?

I'm using Ionic 2 to develop my Android project. I need to send a notification while have detected my iBeacon devices nearby even if my App has been exited.
The following plugins does not work for me:
Background mode: Works while App has been put in background. But what I need is to send notifications while the App has been killed.
Bgs: Doesn't work for me. The founder didn't try Ionic 2 project, so that he cannot figure out what may be the problem. But I do create a project here.
Just hope someone can tell me if it's possible to create an independent background service to retrive data. So that I can stop wasting time.

Listen to websocket on background

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.

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