• Like

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

iOS4時代の位置情報サービスの使い方

  • 8,647 views
Uploaded on

MOSA Software Meeting 2010でCoreLocationサービスの使い方についてセッションを行いました。「駅ベル」で得た位置情報サービスの実情を踏まえた内容になっています。

MOSA Software Meeting 2010でCoreLocationサービスの使い方についてセッションを行いました。「駅ベル」で得た位置情報サービスの実情を踏まえた内容になっています。

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
8,647
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
75
Comments
0
Likes
18

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide


  • こんなモノを作ってます。次はスクリーンショット
  • デモしましょう。












  • と言うことを踏まえた上で、それでもやりたいという人のためのセッションです







  • おそらく、デバイスの中にDBがあるのでは?

  • GPS万歳、というわけではない。

  • 概略は全て話してしまうこと。








  • バックグラウンドの処理については後述

  • 意外と重要、テストしづらい

  • ここから本題。プライバシーの話は、アプリが起動し続けることに対する回答。設定アプリの細かい設定。prompt。




  • バッテリー。ワーニングは起きたときに来ます。遅すぎます。
  • バッテリー、殺されたときの処理。Watchdogが殺す。ユーザーも殺す。
































  • 次で最後。PinkPig


Transcript

  • 1. CoreLocation on iOS 4 iOS4 @basuke
  • 2. 2008 3 2010 6 iOS4
  • 3. Agenda
  • 4. Agenda
  • 5. Agenda CoreLocation
  • 6. Agenda CoreLocation iOS 4
  • 7. Agenda CoreLocation iOS 4
  • 8. Agenda CoreLocation iOS 4
  • 9. Cell Wi-Fi GPS
  • 10. Cell OK 10-50km
  • 11. Wi-Fi Wi-Fi iOS 3.2
  • 12. GPS GPS iPad GPS x3 x1/3 Wi-Fi ↑ ↑ CLLocationAccuracyBestForNavigation
  • 13. GPS > Wi-Fi > Cell GPS > Wi-Fi > Cell GPS > Wi-Fi > Cell
  • 14. iPhone, iPad 3G iPod touch, Mac Wi-Fi
  • 15. CoreLocation CoreLocation CLLocationManager Delegate CLLocation
  • 16. API GPS
  • 17. CLLocationManager CLLocationManager desiredAccuracy distanceFilter delegate start / stop
  • 18. delegate locationManager:didUpdateToLocation: fromLocation: locationManager:didFailWithError:
  • 19. - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { // } - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { // }
  • 20. delegate CLLocationManager Your App Object <CLLocationManagerDelegate>
  • 21. delegate CLLocationManager CLLocation Your App Object <CLLocationManagerDelegate>
  • 22. delegate CLLocationManager CLLocation Your App Object <CLLocationManagerDelegate>
  • 23. CLLocation CLLocationCoordinate2D latitude longitude
  • 24. Significant Location Change Location Region Monitoring
  • 25. Significant Location Change Cell delegate
  • 26. Region Monitoring / Cell delegate
  • 27. 4.0 delegate kCLErrorDenied 4.1 prompt
  • 28. MapKit CoreLocation
  • 29. iOS 4 API
  • 30. Info.plst Required Background Modes background
  • 31. NSTimer
  • 32. BG
  • 33. BG Significant Location Change
  • 34. BG Local Notification
  • 35. BG
  • 36. MapKit MKMapView.showUserLocation = YES BG NO LocatinManager /System/Library/Frameworks/MapKit.framework
  • 37. Significant Location Change Region Monitoring
  • 38. Your App<Delegate> Location Service Daemon CLLocationManager OS
  • 39. Other App Your App<Delegate> Location Service Daemon CLLocationManager OS
  • 40. Other App Location Service Daemon OS
  • 41. Other App Location Service Daemon OS
  • 42. Other App Loc Location Service Daemon OS
  • 43. Other App Loc Your App<Delegate> Location Service Daemon OS
  • 44. Other App Loc Your App<Delegate> Location Service Daemon CLLocationManager OS
  • 45. Other App Loc Your App<Delegate> Location Service Daemon CLLocationManager OS
  • 46. Other App Your App<Delegate> Location Service Daemon CLLocationManager Loc OS
  • 47. Other App Your App<Delegate> Location Service Loc Daemon CLLocationManager OS
  • 48. Other App Your App<Delegate> Location Loc Service Daemon CLLocationManager OS
  • 49. BG CLLocationManager
  • 50. Significant Location Change Region Monitoring BG
  • 51. 3G
  • 52. MVC
  • 53. Tracker PPGLocationService PPGLocationClient PPGLocationService
  • 54. CLLocationManager LocMgr prompt delegate
  • 55. PPGLocationService M CLLocationManager delegate PPGLocationClient KVO
  • 56. PPGLocationClient C M PPGLocationService PPGLocationService 1:N property Invocation, Delegate, Notification
  • 57. 50m BG 300m BG NearbyViewController MapViewController <PPGLocationClient> <PPGLocationClient> Tracker <PPGLocationClient> 1km BG On PPGLocationService CLLocationManager
  • 58. Tracker M PPGLocationClient best 2
  • 59. BG
  • 60. BG Bluetooth
  • 61. iOS4 iPhone
  • 62. KVO Notification Notification OK KVO ChangedNotification
  • 63. KVO 1:N looser cuppling, delegate 1:1 property
  • 64. KVO [target addObserver:observer forKeyPath:path options:options context:nil] NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionInitial
  • 65. - (void)registerClient:(NSObject<PPGLocationServiceDelegate> *)aClient { [clients_ addObject:aClient]; KVO_REGISTER(self, aClient, @"distanceFilter"); KVO_REGISTER(self, aClient, @"desiredAccuracy"); KVO_REGISTER(self, aClient, @"needLocation"); } - (void)unregisterClient:(NSObject<PPGLocationServiceDelegate> *)aClient { KVO_UNREGISTER(self, aClient, @"distanceFilter"); KVO_UNREGISTER(self, aClient, @"desiredAccuracy"); KVO_UNREGISTER(self, aClient, @"needLocation"); [clients_ removeObject:aClient]; [self updateClientsDemand]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqual:@"distanceFilter"]) { // ... } if ([keyPath isEqual:@"desiredAccuracy"]) { // ... } if ([keyPath isEqual:@"needLocation"]) { // ... } }
  • 66. - (void)registerClient:(NSObject<PPGLocationServiceDelegate> *)aClient { [clients_ addObject:aClient]; KVO_REGISTER(self, aClient, @"distanceFilter"); KVO_REGISTER(self, aClient, @"desiredAccuracy"); KVO_REGISTER(self, aClient, @"needLocation"); } - (void)unregisterClient:(NSObject<PPGLocationServiceDelegate> *)aClient { KVO_UNREGISTER(self, aClient, @"distanceFilter"); KVO_UNREGISTER(self, aClient, @"desiredAccuracy"); KVO_UNREGISTER(self, aClient, @"needLocation"); [clients_ removeObject:aClient]; [self updateClientsDemand]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqual:@"distanceFilter"]) { // ... } if ([keyPath isEqual:@"desiredAccuracy"]) { // ... } if ([keyPath isEqual:@"needLocation"]) { // ... } }
  • 67. PPGLocationService 8 NSTimer BG
  • 68. DEBUG HACK BG 10 UIApplication beginBackgroundTaskWithExpiratio nHandler:(void(^)(void))handler RequiredBackgroundModes=audio
  • 69. Breadcrumps - plist or JSON Document Interaction iTunes MapKit
  • 70. PinkPig iPhone Inspired by MediaProbe Three20 GitHub
  • 71. Thank you http://basuke.com/ Twitter: @basuke
  • 72. Thank you ... and Q&A? http://basuke.com/ Twitter: @basuke