Cordova geofence插件问题iOS

时间:2016-06-01 07:27:51

标签: ios angularjs cordova geofencing

我在Angular的项目中使用Meteor。我试图在iOS中集成cordova geofence插件(https://github.com/cowbell/cordova-plugin-geofence)。当我安装插件并执行下面的代码时,地理围栏将检测只退出一次位置。因此,当我再次输入参数时,它不会检测到它。我在互联网上搜索过,发现没有关于这个问题的任何内容。

有人有建议吗?

window.geofence.initialize().then(function () {
        console.log("Successful initialization");
        window.geofence.getWatched().then(function (geofencesJson) {
            var geofences = JSON.parse(geofencesJson);
            console.log(geofences);
        });
    }, function (error) {
        console.log("Error", error);
    });

    window.geofence.removeAll();
    window.geofence.addOrUpdate({
        id:             '10af5fab-39de-43df-b7a1-546cbbafc18c',
        latitude:       coord1, 
        longitude:      coord2, 
        radius:         10,
        transitionType: 3, 
        notification: {         
            id:             1, 
            title:          'HELLO', 
            text:           'Give test juice?', 
            openAppOnClick: true,
            data:           { _id:'sFkS9EJkHGJo9mYTP'}
        }
    }).then(function () {
        console.log('Geofence successfully added');
    }, function (reason) {
        console.log('Adding geofence failed', reason);
    });

    window.geofence.onTransitionReceived = function (geofences) {
        alert('go');
        geofences.forEach(function (geo) {
            alert('Geofence transition detected ' + geo);
        });
    };

0 个答案:

没有答案