WOVER 1.0.0

WOVER 1.0.0

测试已测试
语言语言 Objective-CObjective C
许可 商业
发布最后发布2017 年 5 月

Mobiltron Inc 维护。



WOVER 1.0.0

WOVER™

概览

WOVER 是一个人工智能(AI)平台,它通过尽可能早地识别紧急情况并通知相关人员采取行动,帮助个人最大限度地减少潜在紧急情况的影响,甚至完全避免这些情况。WOVER 的 AI 引擎使用智能手机和可穿戴设备的传感器数据合成个人的运动签名,并随后分析它以检测可能表明紧急情况的异常。

功能

  • 使用来自智能手机和可穿戴设备的活动数据合成独特的运动签名。
  • 检测可能表明紧急情况的运动签名中的异常。
  • 优化以保持低功耗。

要求

  • iOS 9.0 或更高版本。
  • Xcode 8.0 或更高版本。

安装

CocoaPods

  1. 安装 CocoaPods 1.2.0 或更高版本。
  2. 运行 pod repo update 以使 CocoaPods 了解最新可用的 WOVER 版本。
  3. 在您的 Podfile 中添加 use_frameworks!(仅限 Swift 项目)和 pod 'WOVER' 到您的目标。
  4. 从命令行运行 pod install
  5. 使用 CocoaPods 生成的 .xcworkspace 文件来处理您的项目。🤘

设置

添加所需功能

选择根项目,在 功能 下启用以下功能

  1. 后台模式和选择 位置更新

2. 推送通知(可选,请参阅下面的紧急/安全报告部分)。3. HealthKit(可选,用于监视 HealthKit 库)。

最终,“功能”菜单应该像以下这样

Swift 项目

将以下 WOVER 初始化代码添加到您的 AppDelegate.swift

import UIKit
import WOVER

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // Setup WOVER with your api key and enable optional HealthKit data harvesting.
        WOVER.setup(apiKey: "<Your api key>", application: application, healthKit: true)
        return true
    }
}

Objective-C 项目

将以下WOVER初始化代码添加到您的AppDelegate.m文件中。

#import "AppDelegate.h"
@import WOVER;

@interface AppDelegate ()
@end

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Setup WOVER with your api key and enable optional HealthKit data harvesting.
    [WOVER setupWithApiKey:@"<Your api key>" application:application healthKit:@YES];
    return YES;
}

@end

WOVER功能被分为几个部分,使您更容易根据业务需求了解它们,并决定是否使用它们。

认证

最重要的步骤是在WOVER服务中验证最终用户。当终端用户成功认证后,数据采集将自动开始(也请参阅“权限”部分),您将能够使用紧急/安全报告、联系人解析和本地紧急通知。

Swift

let wover = WOVER.sharedInstance()
        
//Authorise new or existing user in WOVER service
wover.userManager.authoriseUser(with: "<Unique id>", firstName: "first_name", middleName: nil, lastName: "last_name", phoneNumber: "e-164 mobile number") { (success, error) in
	//Success wover.userManager.isAuthorised => true
}
        
//Logout an authorised user
wover.userManager.logout { (success, error) in
	//Success wover.userManager.isAuthorised => false
}

Obj-C

WOVER *wover = [WOVER sharedInstance];
    
//Authorise new or existing user in WOVER service
[wover.userManager authoriseUserWith:@"<Unique id>" firstName:@"first_name" middleName:nil lastName:@"last_name" phoneNumber:@"e-164 mobile number" completion:^(BOOL success, NSError * _Nullable error) {
	//Success wover.userManager.isAuthorised => true
}];
    
//Logout an authorised user
[wover.userManager logoutWithCompletion:^(BOOL success, NSError * _Nullable error) {
	//Success wover.userManager.isAuthorised => false
}];

phoneNumber在被用于联系解析时,其他WOVER用户可以使用此终端用户进行解析。

联系人

在WOVER中,终端用户可以通过上传他的联系人列表来创建一个安全网络,即当用户报告紧急情况或回到安全状态时,将会被通知的人。WOVER将解析所有已经是WOVER用户的联系人。当然,已上传的联系人也可以被删除。

Swift

let wover = WOVER.sharedInstance()

//Upload contact in order to find any resolved WOVER contacts.        
let contacts: [CNContact] = ...
_ = wover.userManager.upload(contacts) { (resolvedContacts, error) in
	// Contacts is an array of resolved WOVER contacts.
	//You can store them using NSCoding or dictionary representation.
}

//Remove uploaded contacts.
let contactsToDelete: [CNContact] = ...
_ = wover.userManager.removeContacts(contactsToDelete, completion: { (success, error) in
	// Contacts completely removed from WOVER
})

//Fetch any resolved contacts
_ = wover.userManager.fetchResolvedContacts { (resolvedContacts, error) in
	// Contacts is an array of resolved WOVER contacts.
	//You can store them using NSCoding or dictionary representation.
}

Obj-C

WOVER *wover = WOVER.sharedInstance;

//Upload contact in order to find any resolved WOVER contacts.
NSArray<CNContact *> *contacts = [[NSArray alloc] init];    
[wover.userManager upload:contacts completion:^(NSArray<WOVContactObject *> * _Nullable resolvedContacts, NSError * _Nullable error) {
	// Contacts is an array of resolved WOVER contacts.
	//You can store them using NSCoding or dictionary representation.
}];

//Remove uploaded contacts.
NSArray<CNContact *> *contactsToDelete = [[NSArray alloc] init];
[wover.userManager removeContacts:contactsToDelete completion:^(BOOL success, NSError * _Nullable error) {
	// Contacts completely removed from WOVER
}];

//Fetch any resolved contacts
[wover.userManager fetchResolvedContactsWithCompletion:^(NSArray<WOVContactObject *> * _NullableresolvedContacts, NSError * _Nullable error) {
	// Contacts is an array of resolved WOVER contacts.
	//You can store them using NSCoding or dictionary representation.
}]

解析后的WOVER联系人应该由终端用户分配(请参阅紧急/安全报告部分),以便接收紧急/安全报告。

Swift

let contact: WOVContactObject = ...
let dicForStoring = contact.dictionaryRepresentation()
//Store it.

// Assign        
let storedContact: WOVContactObject = WOVContactObject(parameters: dicForStoring)!
_ = wover.userManager.assign(contacts: [storedContact]) { (success, error) in
	// Mark your UI user is assigned or refetch resolved contacts.
	// ex. storedContact.assigned = success
}

// Deassign
_ = wover.userManager.deassign(contacts: [storedContact], completion: { (success, error) in
	//Mark your UI user is deassigned or refetch resolved contacts.
	// ex. storedContact.assigned = success
})

Obj-C

WOVContactObject *contact = [[WOVContactObject alloc] initWithParameters:...];
NSDictionary *dicForStoring = [contact dictionaryRepresentation];
//Store it.
    
WOVContactObject *storedContact = [[WOVContactObject alloc] initWithParameters:dicForStoring];
    
[wover.userManager assignWithContacts:@[storedContact] completion:^(BOOL success, NSError * _Nullable error) {
	// Mark your UI user is assigned or refetch resolved contacts.
	// ex. storedContact.assigned = success;
}];
    
[wover.userManager deassignWithContacts:@[storedContact] completion:^(BOOL success, NSError * _Nullable error) {
	//Mark your UI user is deassigned or refetch resolved contacts.
	// ex. storedContact.assigned = success;
}];

紧急/安全报告

WOVER用户可以在有紧急情况或安全回到时通知他的安全网络。如果在检测到紧急情况时,WOVER可以自动通知用户的安全网络。当这些事件之一发生时,WOVER会通过后端钩子调用相关信息(包括您组织域中的解析/分配的联系人以及来自WOVER域的解析/分配的联系人)。

Swift 示例

@IBAction func onButton(_ sender: UIButton) {
        let wover = WOVER.sharedInstance()
        // Reports user is in emergency via a UIButton
        wover.emergencyManager.reportEmergency(inEmergency: true,
                                               type: .button,
                                               text: nil) { (success, error) in
                                                //update UI or your logic
        }

        // Or you can check if user is in emergency or not and call the reporting
        // with the correct emergency state
        if wover.emergencyManager.userInEmergency == false {
            //Report emergency
            wover.emergencyManager.reportEmergency(inEmergency: true,
                                                   type: .button,
                                                   text: nil,
                                                   completion: { (success, error) in
                                                    //update UI or your logic
            })

        } else {
            //Report back in safety
            wover.emergencyManager.reportEmergency(inEmergency: false,
                                                   type: .button,
                                                   text: nil,
                                                   completion: { (success, error) in
                                                    //update UI or your logic
            })
        }
    }

Obj-C 示例

- (IBAction)onButton:(UIButton *)sender {

    WOVER *wover = [WOVER sharedInstance];

    // Reports user is in emergency via a UIButton
    [wover.emergencyManager reportEmergencyInEmergency:YES
                                                  type:VerificationTypeButton
                                                  text:nil
                                            completion:^(BOOL success, NSError * _Nullable error) {
                                                //update UI or your logic
                                            }];

    // Or you can check if user is in emergency or not and call the reporting
    // with the correct emergency state
    if (wover.emergencyManager.userInEmergency != YES) {
        //Report emergency
        [wover.emergencyManager reportEmergencyInEmergency:YES
                                                      type:VerificationTypeButton
                                                      text:nil
                                                completion:^(BOOL success, NSError * _Nullable error) {
                                                    //update UI or your logic
                                                }];
    } else {
        //Report back in safety
        [wover.emergencyManager reportEmergencyInEmergency:NO
                                                      type:VerificationTypeButton
                                                      text:nil
                                                completion:^(BOOL success, NSError * _Nullable error) {
                                                    //update UI or your logic
                                                }];
    }
}

紧急本地通知

WOVER允许您在锁屏上显示本地通知以加快紧急报告。此通知只有当用户已认证且不在紧急状态下时才会显示。

要启用紧急本地通知,使用以下代码:

Swift

let wover: WOVER = WOVER.sharedInstance()
wover.emergencyManager.localNotifTitle = "Your custom title"
wover.emergencyManager.localNotifBody = "Your custom body"
wover.emergencyManager.showLocalNotification = true

Obj-C

WOVER *wover = [WOVER sharedInstance];
wover.emergencyManager.localNotifTitle = @"Your custom title";
wover.emergencyManager.localNotifBody = @"Your custom body";
wover.emergencyManager.showLocalNotification = YES;

要处理紧急本地通知,使用以下代码:

Swift

func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
        let wover: WOVER = WOVER.sharedInstance()
        
        if notification.userInfo?[wover.emergencyManager.EmergencyNotificationKey] != nil {
            wover.emergencyManager.reportEmergency(inEmergency: true,
                                                   type: .notification,
                                                   text: nil,
                                                   completion: { (success, error) in
                                                    // Update UI or any business logic
            })
        }
    }

Obj-C

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
    WOVER *wover = WOVER.sharedInstance;
    if (notification.userInfo[wover.emergencyManager.EmergencyNotificationKey] != nil) {
        [wover.emergencyManager reportEmergencyInEmergency:YES
                                                      type:VerificationTypeNotification
                                                      text:nil
                                                completion:^(BOOL success, NSError * _Nullable error) {
                                                    //Update UI or other business logic
                                                }];
    }
}

注意:您的应用应启用推送通知功能,并使用UIApplication的registerUserNotificationSettings方法请求用户权限来显示通知,至少选择设置选项 警报

权限

成功与WOVER服务进行认证后,所有数据采集功能将开始通过原生iOS对话框向终端用户请求权限。

WOVER需要在Info.plist中设置以下权限消息:

  1. NSLocationAlwaysUsageDescription(必需)
  2. NSMotionUsageDescription(必需)
  3. NSHealthShareUsageDescription(如果您使用Health kit,则必需)

如果您有一个入职流程(例如教程等),您可以在认证之前明确请求这些权限。如果您的应用已经请求了此类权限(位置、运动和健康套装),WOVER将不会显示相应的权限请求对话框(静默成功/失败)。

Swift

//Request location permissions
WOVER.sharedInstance().requestLocationPermission()
        
//Request motion permissions
WOVER.sharedInstance().requestMotionPermission()
        
//Request healthkit permissions
WOVER.sharedInstance().requestHealthPermission()

Obj-C

//Request location permissions
[[WOVER sharedInstance] requestLocationPermission];
    
//Request motion permissions
[[WOVER sharedInstance] requestMotionPermission];
    
//Request healthkit permissions
[[WOVER sharedInstance] requestHealthPermission ];

在iOS10中,访问任何功能(例如位置、运动等)都需必须设置权限消息在Info.plist中;否则,应用将会崩溃。[更多信息请参阅这里](https://developer.apple.com/videos/play/wwdc2016/709/)。

注意:苹果对请求HealthKit权限非常敏感,并且相关的功能未启用。在这种情况下,将显示如下日志:

Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo={NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}

反馈

我们非常重视您的反馈。请将您的建议提交至[邮箱地址保护中]

许可证

商业

Mobiltron, Inc.