IngeoSDK是iOS(Swift和Objective-C)的高效地点管理器,它扩展并改进了CoreLocation。
它使用独特的算法根据用户的运动、行为、速度和位置动态地不断调整CoreLocation的跟踪配置参数。从而实现适合优化的精度和最少功耗的配置方案,实时进行。
无论是前台还是后台,您的应用程序和/或服务器都将接收到最相关的位置数据——即使在网络断开的情况下。当然,或差的位置样本已被过滤。电池消耗仅为每小时~2%。
支持运行iOS 7.0+的iPhone、iPad和iPod Touch。
要查看完整功能列表,请访问:http://ingeo.io/sdk
在ViewController.swift中编辑,将API密钥添加到初始化方法中
IGLocationManager.initWithDelegate(self, secretAPIKey: "APIKEYGOESHERE")
要获取新的API密钥,请免费注册。
在Xcode中,转到您的目标设置 -> '功能' -> '后台模式'
启用'位置更新'。
编辑您的应用程序的Info.plist并在其中添加以下字符串密钥(无空值)
NSLocationAlwaysUsageDescription
导入
import IngeoSDK
设置代理
class ViewController: UIViewController, IGLocationManagerDelegate {
初始化
IGLocationManager.initWithDelegate(self, secretAPIKey: "APIKEYGOESHERE")
开始位置监控
IGLocationManager.startUpdatingLocationAlwaysOn()
或者
IGLocationManager.startUpdatingLocationWhenInUse()
获得蜂蜜
在您的代理中实现IGLocationManagerDelegate方法。
Swift
func igLocationManager(manager: IGLocationManager!, didUpdateLocation igLocation: IGLocation!) {
print("didUpdateLocation: \(igLocation.description)")
}
func igLocationManager(manager: IGLocationManager!, didDetectMotionState motionState: IGMotionState) {
print("didDetectMotionState: \(IGLocation.stringForMotionState(motionState))")
}
Objective-C
- (void)igLocationManager:(IGLocationManager *)manager didUpdateLocation:(IGLocation *)igLocation {
NSLog(@"didUpdateLocation: %@", [igLocation description]);
}
- (void)igLocationManager:(IGLocationManager *)manager didDetectMotionState:(IGMotionState)motionState {
NSLog(@"didDetectMotionState: %@",[IGLocation stringForMotionState:motionState]);
}
就这样。您已经启用了持续的位置监控。
坐在那里,通过管理员仪表板观察您的用户http://admin.ingeo.io。
API完整参考:http://ingeo.io/sdk/docs
Apache v2.0
请随时通过[email protected]联系我们或在此处打开问题。