标签: geofencing

如何提高区域边界跨越精度(模拟)(地理围栏)

我把一个应用程序放在一起,当用户离开房子时发出通知.所以我实现了半径为25的区域监控.我遇到的问题是模拟时(iPhone模拟器5.0),我设置了一个自定义位置(home)设置区域边界.然后输入区域边界外的另一个自定义位置,即在街道的尽头.但该应用程序没有注册退出该地区.只有当我设置了家庭位置和地区,然后更改为Apple总部,它会注册并发出通知.在后台模式下,应用切换到重要的位置更改.但是在前台或后台时它有同样的问题.正在寻找的内容,如"提醒"应用程序,是应用程序在退出/离开区域边界后立即发出通知,即走到街道的尽头.我如何使其更准确?

这是我的一些viewcontroller.m文件:

- (void)viewDidLoad {
    [super viewDidLoad];

  // Create empty array to add region events to.
  updateEvents = [[NSMutableArray alloc] initWithCapacity:0];

  // Create location manager with filters set for battery efficiency.
  locationManager = [[CLLocationManager alloc] init];
  locationManager.delegate = self;
  locationManager.distanceFilter = kCLLocationAccuracyBest; //could try KLDistanceFilterNone;
  locationManager.desiredAccuracy = kCLLocationAccuracyBest;

  // Start updating location changes.
          [locationManager startUpdatingLocation];
}

- (void)viewDidAppear:(BOOL)animated {
  // Get all regions being monitored for this application.
  NSArray *regions = [[locationManager monitoredRegions] allObjects];

  // Iterate through the regions and …
Run Code Online (Sandbox Code Playgroud)

location geolocation ios ios-simulator geofencing

2
推荐指数
1
解决办法
5142
查看次数

startMonitoringForRegion vs CLRegion:containsCoordinate

在我的IOS应用程序中,我正在实现地理围栏.在当前的实现中,我使用的代码如下:

  CLRegion* region3 = [[CLRegion alloc] initCircularRegionWithCenter:coordinates radius:100 identifier:@"region3"];
[self.locationManager startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyHundredMeters];
Run Code Online (Sandbox Code Playgroud)

然后我使用这些委托方法:

 (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{
        NSLog(@"didenterregion");

    }
    (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region{
        NSLog(@"didexitregion");
    }

    (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error
    {NSLog(@"monitoringDidFailForRegion");}
Run Code Online (Sandbox Code Playgroud)

但是,此代码仅适用于大于100米的半径.

以下是一些问题:

  1. Apple称,在ios6及以上版本中,4s及以上的设备支持1到400m之间的半径.因为我不在乎需要多长时间才能看到这条消息(就像我不想在进入该地区时看到这条消息,但如果我从该地区过去过一次,我确实想看到后者)我可以使用较小的半径?我对50米半径或更小的东西感兴趣?(在某些地区,我的情况甚至需要20米).

我也想到了.Apple表示可以支持多达20个地区.像这样的溶剂有什么优点/缺点(我还没有实现,但我想要你的意见).

伪代码将是这样的:

Declare the regions - save them in an array
Do not call start monitoring
Run Code Online (Sandbox Code Playgroud)

然后在委托方法中:

- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
      for loop in all my regions {
         if ([region containsCoordinate: newLocation.coordinate])
            code for entering region
      } 
}
Run Code Online (Sandbox Code Playgroud)
  1. 它会慢吗?
  2. 它会消耗更多的电池吗?(我认为对地区进行监测并不耗电)?
  3. 它会更准确吗? …

mkmapview ios geofencing clregion

2
推荐指数
1
解决办法
1326
查看次数

想要为谷歌地图创建地理围栏.如何在地图上绘制以选择地理围栏?

我一直致力于在谷歌地图中创建地理围栏.我创建了一个用户可以放置纬度和经度的表单.现在我想在地图中显示特定的选定部分.一旦用户输入值并按"创建地理围栏",它应该在地图上显示给定的范围.在将经度和纬度值放在表单上之后,请帮我在地图上创建地理围栏.

Below is the link of JSFiddle for geofence. 

http://jsfiddle.net/h0abau2q/
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3 geofencing

2
推荐指数
1
解决办法
8574
查看次数

Xamarin Forms - 每 10 秒获取一次设备位置(当应用在前台/后台运行时)

我创建了一个 Xamarin 表单应用程序。应用程序应定期(每 10 秒)获取设备的位置(iOS 和 Android)。我怎样才能做到这一点?我知道有一些库,例如:Xamarin.Essentials,但我无法决定该位置应该被占用多少次。

当 Xamarin 表单应用程序在后台运行时(在 IOS 和 Android 上),也应该可以获取设备的本地信息。

geolocation background-process geofencing xamarin.forms

2
推荐指数
1
解决办法
4929
查看次数

Android wifi地理围栏/后台位置查询

我正在编写一个Android应用程序(不是一个新颖的应用程序),它将根据用户的位置关闭/打开用户的wifi.它将使用网络的位置获取大致位置.我基本上使用Google地图将他们创建的地理围栏保存到我的数据库中.我很好奇什么是最好的方法,确保应用程序不必在前台才能正常工作.

我应该使用addProximityAlert或不同的东西?考虑到我正在创建多个地理围栏并且用户可能有10个设置,我担心为每个地理围栏使用不同的邻近侦听器.相反,每15分钟左右查询位置似乎更节能,然后让应用程序决定它是否在任何这些地理围栏的合理范围内.

让我知道,感谢帮助.

android geofencing

1
推荐指数
2
解决办法
5946
查看次数

iOS didEnterRegion从未调用过

iOS和gefencing有一些问题......

//
//  ViewController.m
//  
//
//  Created by me on 14.05.13.
//  Copyright (c) 2013 me. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<CLLocationManagerDelegate>

{
    CLLocationManager *locationManager;
    CLRegion *testRegion;
}
#define METERS_PER_MILE 1609.344
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self initlocationManager];
//    [self startlocationManager];
}

// init location Manager Object, set delegation, result and accurate
- (void)initlocationManager {
    //create location manager object
    locationManager = [[CLLocationManager alloc]init];

    //this instance send its messages to our AppDelegate
    [locationManager setDelegate:self]; …
Run Code Online (Sandbox Code Playgroud)

locationmanager ios geofencing clregion

1
推荐指数
1
解决办法
3445
查看次数

从地理围栏示例项目获取当前位置

我正在尝试 Google 的地理围栏示例项目。我正确获取进入/退出事件。但我怎样才能从中获取用户的当前位置。我想即使在进入/退出点之后也能跟踪用户位置。请帮忙。示例项目来自开发者门户。

location geolocation latitude-longitude geofencing android-geofence

1
推荐指数
1
解决办法
2873
查看次数

如果设备已经在Geofence android内部,则停止初始触发

我在android上使用Geofencing,当创建geo-fence时,如果用户已经在geo-fence中,设备会收到通知,这不是我正在寻找的行为,我只想通知转换ENTER和出口.

这就是我创建地理围栏请求的方式:

private GeofencingRequest createGeoFenceRequest(List<Geofence> geofenceList) {
        return new GeofencingRequest.Builder()

                //The INITIAL_TRIGGER_ENTER is used to notify the user initially if he/she/other
                //is already inside the geo-fence zone
                //.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER)

                .addGeofences(geofenceList)
                .build();
    }
Run Code Online (Sandbox Code Playgroud)

在我的GeofenceTransitionService.java中:

@Override
protected void onHandleIntent(@Nullable Intent intent) {

    if (intent != null) {
        geofencingEvent = GeofencingEvent.fromIntent(intent);

        // Retrieve the transition type.
        geoFenceTransition = geofencingEvent.getGeofenceTransition();

    }
}
Run Code Online (Sandbox Code Playgroud)

过渡类型以Geofence.GEOFENCE_TRANSITION_ENTER的形式返回,即使我没有进入,我已经在地理围栏中了.任何人都知道如何阻止这个初始触发器?

android location geolocation geofencing android-geofence

1
推荐指数
1
解决办法
1551
查看次数

检查点是否落在地理围栏内?

是否可以使用iOS 5 API检查给定的经度和纬度是否属于给定的GeoFence?怎么样?

objective-c core-location ios geofencing

0
推荐指数
1
解决办法
2443
查看次数

有没有用于计算除Android API之外的Geofence破坏的API

我想计算后端的地理围栏破坏和行驶距离计算.这是我第一次使用谷歌API.我在网上找到的只是Android版.是否有任何特定于常规计算的API.

java geofencing

0
推荐指数
1
解决办法
3815
查看次数

如何为iOS 9实现地理围栏?

我的iOS 9应用程序需要地理围栏功能.哪些API提供商提供地理围栏功能?我检查了Foursquare,他们似乎没有提供这个. Geoloqi刚刚被收购,这个选择似乎也是不可能的.

如果没有第三方选项可用,那么如何为iOS实现地理围栏呢?

ios geofencing ios9

0
推荐指数
1
解决办法
4856
查看次数