Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cordova-plugin-background-geolocation
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Aksimaya
cordova-plugin-background-geolocation
Commits
270c3042
Commit
270c3042
authored
Jan 15, 2014
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consolidate a bunch of getter methods into one setConfig method
parent
10402f75
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
83 deletions
+38
-83
CDVBackgroundGeoLocation.h
src/ios/CDVBackgroundGeoLocation.h
+1
-3
CDVBackgroundGeoLocation.m
src/ios/CDVBackgroundGeoLocation.m
+37
-59
BackgroundGeoLocation.js
www/BackgroundGeoLocation.js
+0
-21
No files found.
src/ios/CDVBackgroundGeoLocation.h
View file @
270c3042
...
@@ -13,9 +13,7 @@
...
@@ -13,9 +13,7 @@
-
(
void
)
stop
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
stop
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
finish
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
finish
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
onPaceChange
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
onPaceChange
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
setStationaryRadius
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
setConfig
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
setDesiredAccuracy
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
setDistanceFilter
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
sync
:(
CLLocation
*
)
location
;
-
(
void
)
sync
:(
CLLocation
*
)
location
;
-
(
void
)
onSuspend
:(
NSNotification
*
)
notification
;
-
(
void
)
onSuspend
:(
NSNotification
*
)
notification
;
...
...
src/ios/CDVBackgroundGeoLocation.m
View file @
270c3042
...
@@ -65,7 +65,6 @@
...
@@ -65,7 +65,6 @@
// Set a movement threshold for new events.
// Set a movement threshold for new events.
locationManager
.
activityType
=
CLActivityTypeOther
;
locationManager
.
activityType
=
CLActivityTypeOther
;
locationManager
.
pausesLocationUpdatesAutomatically
=
YES
;
locationManager
.
pausesLocationUpdatesAutomatically
=
YES
;
locationManager
.
distanceFilter
=
distanceFilter
;
// meters
myRegion
=
nil
;
myRegion
=
nil
;
...
@@ -77,6 +76,33 @@
...
@@ -77,6 +76,33 @@
NSLog
(
@" - locationTimeout: %ld"
,
(
long
)
locationTimeout
);
NSLog
(
@" - locationTimeout: %ld"
,
(
long
)
locationTimeout
);
NSLog
(
@" - desiredAccuracy: %ld"
,
(
long
)
desiredAccuracy
);
NSLog
(
@" - desiredAccuracy: %ld"
,
(
long
)
desiredAccuracy
);
}
}
-
(
void
)
setConfig
:(
CDVInvokedUrlCommand
*
)
command
{
NSLog
(
@"- CDVBackgroundGeoLocation setConfig"
);
NSDictionary
*
config
=
[
command
.
arguments
objectAtIndex
:
0
];
if
(
config
[
@"desiredAccuracy"
])
{
desiredAccuracy
=
[
config
[
@"desiredAccuracy"
]
intValue
];
NSLog
(
@" desiredAccuracy: %@"
,
config
[
@"desiredAccuracy"
]);
}
if
(
config
[
@"stationaryRadius"
])
{
stationaryRadius
=
[
config
[
@"stationaryRadius"
]
intValue
];
NSLog
(
@" stationaryRadius: %@"
,
config
[
@"stationaryRadius"
]);
}
if
(
config
[
@"distanceFilter"
])
{
distanceFilter
=
[
config
[
@"distanceFilter"
]
intValue
];
NSLog
(
@" distanceFilter: %@"
,
config
[
@"distanceFilter"
]);
}
if
(
config
[
@"timeout"
])
{
locationTimeout
=
[
config
[
@"timeout"
]
intValue
];
NSLog
(
@" locationTimeout: %@"
,
config
[
@"timeout"
]);
}
CDVPluginResult
*
result
=
nil
;
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}
/**
/**
* Turn on background geolocation
* Turn on background geolocation
*/
*/
...
@@ -116,57 +142,6 @@
...
@@ -116,57 +142,6 @@
[
self
setPace
:
isMoving
];
[
self
setPace
:
isMoving
];
}
}
}
}
/**
* Change stationary radius
*/
-
(
void
)
setStationaryRadius
:(
CDVInvokedUrlCommand
*
)
command
{
stationaryRadius
=
[[
command
.
arguments
objectAtIndex
:
0
]
intValue
];
NSLog
(
@"- CDVBackgroundGeoLocation setStationaryRadius %d"
,
stationaryRadius
);
UIApplicationState
state
=
[[
UIApplication
sharedApplication
]
applicationState
];
if
(
state
==
UIApplicationStateBackground
)
{
[
self
setPace
:
isMoving
];
}
CDVPluginResult
*
result
=
nil
;
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}
/**
* Change distance-filter
*/
-
(
void
)
setDistanceFilter
:(
CDVInvokedUrlCommand
*
)
command
{
distanceFilter
=
[[
command
.
arguments
objectAtIndex
:
0
]
intValue
];
NSLog
(
@"- CDVBackgroundGeoLocation setDistanceFilter %d"
,
distanceFilter
);
UIApplicationState
state
=
[[
UIApplication
sharedApplication
]
applicationState
];
if
(
state
==
UIApplicationStateBackground
)
{
[
self
setPace
:
isMoving
];
}
CDVPluginResult
*
result
=
nil
;
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}
/**
* Change stationary radius
*/
-
(
void
)
setDesiredAccuracy
:(
CDVInvokedUrlCommand
*
)
command
{
desiredAccuracy
=
[[
command
.
arguments
objectAtIndex
:
0
]
intValue
];
NSLog
(
@"- CDVBackgroundGeoLocation setDesiredAccuracy %d"
,
desiredAccuracy
);
UIApplicationState
state
=
[[
UIApplication
sharedApplication
]
applicationState
];
if
(
state
==
UIApplicationStateBackground
)
{
[
self
setPace
:
isMoving
];
}
CDVPluginResult
*
result
=
nil
;
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}
/**
/**
* Called by js to signify the end of a background-geolocation event
* Called by js to signify the end of a background-geolocation event
*/
*/
...
@@ -302,6 +277,14 @@
...
@@ -302,6 +277,14 @@
NSLog
(
@" distanceFilter: %d"
,
distanceFilter
);
NSLog
(
@" distanceFilter: %d"
,
distanceFilter
);
NSLog
(
@" stationaryRadius: %d"
,
stationaryRadius
);
NSLog
(
@" stationaryRadius: %d"
,
stationaryRadius
);
// First turn off all monitoring.
if
(
myRegion
!=
nil
)
{
[
locationManager
stopMonitoringForRegion
:
myRegion
];
myRegion
=
nil
;
}
[
locationManager
stopMonitoringSignificantLocationChanges
];
[
locationManager
stopUpdatingLocation
];
switch
(
desiredAccuracy
)
{
switch
(
desiredAccuracy
)
{
case
1000
:
case
1000
:
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyKilometer
;
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyKilometer
;
...
@@ -317,16 +300,11 @@
...
@@ -317,16 +300,11 @@
break
;
break
;
}
}
if
(
myRegion
!=
nil
)
{
locationManager
.
distanceFilter
=
distanceFilter
;
// meters
[
locationManager
stopMonitoringForRegion
:
myRegion
];
myRegion
=
nil
;
}
if
(
value
==
YES
)
{
if
(
value
==
YES
)
{
[
locationManager
stopMonitoringSignificantLocationChanges
];
locationManager
.
distanceFilter
=
distanceFilter
;
[
locationManager
startUpdatingLocation
];
[
locationManager
startUpdatingLocation
];
}
else
{
}
else
{
[
locationManager
stopUpdatingLocation
];
[
self
startMonitoringStationaryRegion
];
[
self
startMonitoringStationaryRegion
];
[
locationManager
startMonitoringSignificantLocationChanges
];
[
locationManager
startMonitoringSignificantLocationChanges
];
}
}
...
...
www/BackgroundGeoLocation.js
View file @
270c3042
...
@@ -78,27 +78,6 @@ module.exports = {
...
@@ -78,27 +78,6 @@ module.exports = {
'
BackgroundGeoLocation
'
,
'
BackgroundGeoLocation
'
,
'
setConfig
'
,
'
setConfig
'
,
[
config
]);
[
config
]);
},
setStationaryRadius
:
function
(
value
,
success
,
failure
)
{
exec
(
success
||
function
()
{},
failure
||
function
()
{},
'
BackgroundGeoLocation
'
,
'
setStationaryRadius
'
,
[
value
]);
},
setDesiredAccuracy
:
function
(
value
,
success
,
failure
)
{
exec
(
success
||
function
()
{},
failure
||
function
()
{},
'
BackgroundGeoLocation
'
,
'
setDesiredAccuracy
'
,
[
value
]);
},
setDistanceFilter
:
function
(
value
,
success
,
failure
)
{
exec
(
success
||
function
()
{},
failure
||
function
()
{},
'
BackgroundGeoLocation
'
,
'
setDistanceFilter
'
,
[
value
]);
}
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment