iOS ジオフェンシングで簡単リアル連動
-
Upload
ochi-shuji -
Category
Technology
-
view
4.972 -
download
2
description
Transcript of iOS ジオフェンシングで簡単リアル連動
![Page 1: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/1.jpg)
iPhone の位置情報でリアル連動を!
KLab 株式会社
越智 修司 (@ponpoko1968)
![Page 2: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/2.jpg)
自己紹介
越智修司 (@ponpoko1968)
• KLab( くらぶ ) 株式会社 大阪事業所
• アプリ・サービスのプロトタイピング( iOS )
• 有名アーティスト・アイドルのファンクラブアプリ開発
• 最近はデータ解析
• python,R など
![Page 3: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/3.jpg)
作ったもの
「クリップリーダー」 電子書籍リーダー
• 自炊PDFに特化• evernote連携• 段組書籍
「勤怠くん」( 無料 )勤怠メールを素早く送信
iPhone 版(無料)
iPad 版( 85 円)
![Page 4: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/4.jpg)
クリップリーダー
• PDF リーダー
![Page 5: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/5.jpg)
洋ゲー大好き♪
• ゲーマータグ
• ponpoko1968
![Page 6: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/6.jpg)
ジオフェンス機能
![Page 7: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/7.jpg)
ジオフェンス機能
• あらかじめ指定した位置座標の範囲に入る/出るとコードが実行される
![Page 8: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/8.jpg)
緯度、経度で指定
緯度、経度で指定
半径半径
![Page 9: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/9.jpg)
領域の登録 // CLLocationManagerインスタンスの初期化 // アプリ内に 1 つ作る self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; // ジオフェンス作動領域の設定 CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(latitude, longitude); CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:coordinates
radius:radius identifier:@"Home"];
// 感知領域を設定 [self.locationManager startMonitoringForRegion:grRegion desiredAccuracy:kCLLocationAccuracyBest];
// CLLocationManagerインスタンスの初期化 // アプリ内に 1 つ作る self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; // ジオフェンス作動領域の設定 CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(latitude, longitude); CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:coordinates
radius:radius identifier:@"Home"];
// 感知領域を設定 [self.locationManager startMonitoringForRegion:grRegion desiredAccuracy:kCLLocationAccuracyBest];
![Page 10: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/10.jpg)
![Page 11: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/11.jpg)
ジオフェンス作動時コールバック
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{
manager.location // 現在位置region.center // 感知範囲の中心座標region.radius // 感知範囲の半径
}
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{
manager.location // 現在位置region.center // 感知範囲の中心座標region.radius // 感知範囲の半径
}
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region{
...
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region{
...
![Page 12: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/12.jpg)
コールバック内でできること
• http 通信
• iOS では、 GUI を出さずにメール送信できないので http を介するなどの一工夫が必要
• ローカルプッシュ通知
• ファイルや Core Data 等に永続化
![Page 13: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/13.jpg)
応用例
• ライフログ
• リマインダ
• ローカルプッシュ通知ノーティフィケーションとの組み合わせ
• ジオフェンスが作動したらローカルプッシュ通知で通知してユーザにアプリ起動を促す。
![Page 14: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/14.jpg)
メリット
iOS では難しい、ユーザ操作なし
のアプリ機能の起動が実現できる
![Page 15: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/15.jpg)
メリット
意表を突いたユーザの呼び戻し
![Page 16: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/16.jpg)
デメリット
• プライバシー保護は慎重に!!
• 地下鉄内などは位置情報が狂います
• 一定、誤差はあるよ
![Page 17: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/17.jpg)
ソーシャルゲームへの応用たとえば、、、、
• 来店促進などのリアル連動
• インセンティブ付与
• バーコードや FeliCa リーダなど、ロケーション側の準備が不要
• ユーザがそこに行くだけ!!
![Page 18: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/18.jpg)
実は、絶賛開発中
![Page 19: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/19.jpg)
フィールドテストの結果わかったこと
• 電池消費は問題なさそう
• 誤差
• ジオフェンス作動範囲設定の下限は、半径 100m 位
• ±30 〜 50 m程度
• これ以上範囲を狭めても誤差が目立ってしまう
![Page 20: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/20.jpg)
宣伝
iPhone 技術者絶賛募集中です
• iOS や Objective-C の話で盛り上がれる人、一緒にしませんか?
• 勤務地:大阪 です!
![Page 21: iOS ジオフェンシングで簡単リアル連動](https://reader036.fdocuments.net/reader036/viewer/2022081519/5566066fd8b42aa6628b4cf2/html5/thumbnails/21.jpg)
ご清聴ありがとうございました