Integrate Android Service on NativeScript App - android

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

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?

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!

Is there a way to remotely monitor a specific Android application?

There is an android application I am planning to write, that will be used as an "always on" application (kiosk-mode) used on Android tablets running restaurant menu. Today, I already have a rudimentary application, but it is not quite what might qualify as kiosk-mode, since sometimes users close the application.
I wanted to see if there is a way to monitor the application remotely (or on device itself) and automatically restart it, s.t. it comes the foreground application ?
Of course, I'd prefer to remotely monitor for some remote customer service. It is not exactly essential to view (in remote desktop / vnc sense), but gather information like application health (running in foreground or not), get it's logs etc. Now I understand that on an unrooted device an applications log is not visible to other applications. So I was wondering if I could design my application to create light logs or status information, in a non-standard way, that could be shared by my other monitoring application.
While I get a feel that I am reinventing the wheel, since requirements like these seem far-from-unique, but in my search haven't found much beyond the standard 'screen cast' / 'screen share' applications... most of which either don't work too well (especially without root), or need one to jump through hoops to get them working.
There are ways to monitor activities of your application. There are utilities available to help you keep logs of events carried out by the users of the application. Like getting statistical information. They are typically Mobile Analytics tools.
Check this for instance: https://mixpanel.com/
This for example can help to keep track of events fired by the application. You can even send mails and notification to the users. There are similar tools available. For instance Google Analytics for Mobile Apps
The other possibility is to use Google Cloud Messaging. I believe this is even more powerful, which may help us to control our application to some extent. You may find this of help: http://hmkcode.com/android-google-cloud-messaging-tutorial/

android IncomingHandler not fired when we close the application by removing from recent list

I am writing a sample application for detecting iBeacons through android app. I am using the code from the following site https://github.com/AlvinBert/android-ibeacon-Jaalee-source-code
With the code from the above site i can able to detect ibeacons and send notifications. When i check the running apps, there is 1 Service running.
If i close my application, by long press the home key and remove my app from the Recent list, then i didn't get the notifications, but still 1 service is running.
I debug the code and found that "IncomingHandler" is not getting fired which is in the service inside the "com.communicate.ibeacon.service.IBeaconService" package.
I need this to be called continuously, even after the application closes. Since, i am new to android could you please point me what to do, to achieve this.
Thanks
Jai
The beacon library you mention is an unauthorized copy of the Pro Android iBeacon Library formerly provided by Radius Networks. As the original author of that library, I can confirm that it would not detect beacons after the app being killed until a power cycle of the phone takes place. Unfortunately, this library had been discontinued by my company over licensing issues.
Library issues aside, one approach you could take to accomplish your goal is to use Androud Broadcast Intents to automatically re-launch your app based on system events like power connected and disconnected. This will not relaunch immediately, but will typically do so once a day when a device is in normal use.

Categories

Resources