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,
To run a NativeScript app, you will need an Android device — either a physical or a virtual device. Using a virtual device: Open Android Studio, and then open "AVD Manager" — if you are on the welcome screen, then it's under the Configure › AVD Manager dropdown, otherwise it's under the Tools › AVD Manager menu.
Description. Runs your project on all connected devices or in native emulators for the selected platform. The command will work with all currently running Android devices and emulators. The command will prepare, build and deploy the app when necessary.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With