Can I activate Monitoring while app is killed using cordova?

Hello!

I am working on an mobile application for iOS and Android with a beacon feature. I use the cordova plugin von evothings. The idea is to notify the user if he enters a (beacon-) zone defined by me. I set up a region by the data of one beacon:

var myregion =
{
    identifier: 'Region Hello World',
    uuid: 'XXXXXXXX-XXX-XXXX-XXXX-XXXXXXXXXXX1F',
    major : '1234',
    minor : '1235'
};

When the app is in foreground or in background I get the “regionentered” and “regionexit” states. The problem now is that this is not working if the app is killed. Either on iOS than on Android…

The startMonitoring funtion is after the “document.ready” event. So I think the startMonitoring for Reagion is not running until the app is opened once.

function onDeviceReady()
    function startMonitoring(){
        var myregion =
        {
            identifier: 'Region Hello World',
            uuid: 'XXXXXXXX-XXX-XXXX-XXXX-XXXXXXXXXXX1F',
            major : '1234',
            minor : '1235'
         };

     estimote.beacons.startMonitoringForRegion(
         myregion,
         function(state) {
             console.log('Region state: ' + JSON.stringify(state));
             $('#showRegion').html(state.state + ' ' + state.identifier);
         },
         function(errorMessage) {
             console.log('Monitoring error: ' + errorMessage);
         }
     );
}

Now I wonder if there is a possibility to start a service always running and scanning in background using cordova?

Thanks!

Did you ever get this working? I’ve definitely got this working in Native Android.

Unfortunately not under cordova…

Hi @xcyde_dom,
You can take a look at this Cordova plugin https://github.com/katzer/cordova-plugin-background-mode

@xcyde_dom, hi there. i tried the github plugin you mentioned in the previous reply. however, i do not receive any notification when the application is killed from the task manager.