motion-locman 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -3
- data/lib/locman/manager.rb +9 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eab7a719aa3cff4789604ed256a94f738f5530c
|
4
|
+
data.tar.gz: 642821df68ca8714b9a860b3612c0f3b3fa10aa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c597babcfd85c324893b100c66fb0f2a316dd4d62a31b71f73856e8f26369fc156a1074a94c40bf17b5a27107bea777889dec4cd0320aa6ae638edb398869c17
|
7
|
+
data.tar.gz: a919aa9ed8b19530ced1349373725d110b7d35285aa42e04a6e276efe861e9912086f1b10303e768d3e617d0c5c568b57e8c935ecf474cb12a277b3cb64287f6
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Simple location library for Rubymotion
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem "motion-locman"
|
9
|
+
gem "motion-locman", "~> 0.2"
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -22,6 +22,7 @@ Initialize a new **Locman::Manager**, request for user authorization:
|
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
@manager = Locman::Manager.new(
|
25
|
+
background: true, # for background udpates
|
25
26
|
accuracy: :ten_meters,
|
26
27
|
distance_filter: 20 # in meter
|
27
28
|
)
|
@@ -33,14 +34,25 @@ end
|
|
33
34
|
@manager.authorize!
|
34
35
|
```
|
35
36
|
|
36
|
-
Start receiving location updates:
|
37
|
+
Start monitoring and receiving location updates:
|
37
38
|
|
38
39
|
```ruby
|
39
40
|
@manager.on_update = lambda do |locations|
|
40
41
|
locations.each { |loc| puts "(#{loc.latitude}, #{loc.longitude})" }
|
41
42
|
end
|
42
43
|
|
43
|
-
@manager.
|
44
|
+
@manager.update! # Starts receiving normal location updates
|
45
|
+
@manager.update_significant! # Starts receiving significant location updates
|
46
|
+
```
|
47
|
+
|
48
|
+
Start monitoring and receiving visits:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
@manager.on_visit = lambda do |visit|
|
52
|
+
puts "#{visit.latitude},#{visit.longitude} @ #{visit.departed_at}~#{visit.arrived_at}"
|
53
|
+
end
|
54
|
+
|
55
|
+
@manager.update_visits! # Start receiving visit updates
|
44
56
|
```
|
45
57
|
|
46
58
|
## License
|
data/lib/locman/manager.rb
CHANGED
@@ -116,7 +116,7 @@ module Locman
|
|
116
116
|
nil
|
117
117
|
end
|
118
118
|
|
119
|
-
def
|
119
|
+
def update!
|
120
120
|
if CLLocationManager.authorizationStatus != KCLAuthorizationStatusAuthorized
|
121
121
|
fail(Exception, "Location permission is not authorized by user")
|
122
122
|
end
|
@@ -124,24 +124,24 @@ module Locman
|
|
124
124
|
manager.startUpdatingLocation
|
125
125
|
end
|
126
126
|
|
127
|
-
def
|
127
|
+
def stop_update!
|
128
128
|
manager.stopUpdatingLocation
|
129
129
|
end
|
130
130
|
|
131
|
-
def
|
131
|
+
def update_significant!
|
132
132
|
manager.startMonitoringSignificantLocationChanges
|
133
133
|
end
|
134
134
|
|
135
|
-
def
|
136
|
-
manager.
|
135
|
+
def stop_update_significant!
|
136
|
+
manager.stopMonitoringSignificantLocationChanges
|
137
137
|
end
|
138
138
|
|
139
|
-
def
|
140
|
-
manager.
|
139
|
+
def update_visits!
|
140
|
+
manager.startMonitoringVisits
|
141
141
|
end
|
142
142
|
|
143
|
-
def
|
144
|
-
manager.
|
143
|
+
def stop_update_visits!
|
144
|
+
manager.stopMonitoringVisits
|
145
145
|
end
|
146
146
|
|
147
147
|
# Delegates
|