12

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,

Ox3
  • 451
  • 1
  • 6
  • 22

1 Answers1

1

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

MatanCo
  • 374
  • 2
  • 14
  • No really, the fist link points out to a method to implement a sort of service with NativeScript, not how to include a native android service class written in Java within a NativeScript app and observe events/messages generated by it. – Ox3 Aug 23 '17 at 05:38