gurudey / Titanium-Appcelerator-GeoFence-Module-iOS

Titanium Appcelerator GeoFence Module for iOS Only
Other
6 stars 4 forks source link

Only "monitoring_region" #1

Open oakleaf opened 6 years ago

oakleaf commented 6 years ago

Hello, this is exactly what Im looking for! Awesome for that. But my issue is that it doesnt work for me at all. Well, Im successfully registering regions,

Started monitoring blaha region { identifier = blaha; source = "[object CiGeofencingModule]"; type = "monitoring_region"; }

And the region Im testing has a radius for 10, which Im thinking means 10 meters for this module (?)

I have enabled "Location" as background data in the TiApp-file too.

Am I missing something here? The events are not firing while I work in and outside the region.

gurudey commented 6 years ago

Yes radius are in meters

ci_geofencing.startGeoFencing(regions, function(event) {
    if (event.type == "entered_region")
    {
    var notification = Ti.App.iOS.scheduleLocalNotification({
        alertAction: "Open",
        alertBody: "Hello",
        userInfo:{"hello":"world"},
    });
    }
});

Events works when you enter or exit a region. Make sure you have AUTHORIZATION_ALWAYS permissions.

Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {
    if (!e.success) {
        Ti.API.info("-----------requestLocationPermissionsOFF----------");
    }
});
oakleaf commented 6 years ago

That is exactly how I structured everything. Been running some tests now, created 3 different regions now with different radius (50, 100 & 150m) and for a reason the one with 100m radius worked. Not awesome, but at least it showed me some data.

When looking at some other solutions in native, they've set the parameter to "identifier", which I think you use as "title". Might be a confusing thing.

One question though, would you mind share the module, maybe I can fork it and work further with it? Im missing some basic functionality such as resetting and extending regions.

Thanks!