Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cordova-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-background-geolocation
Commits
74592aa0
Commit
74592aa0
authored
Apr 17, 2015
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some sanity-detection logic to try and fix reported crashes
parent
6099e4b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
BackgroundGeolocationService.java
src/android/BackgroundGeolocationService.java
+13
-5
No files found.
src/android/BackgroundGeolocationService.java
View file @
74592aa0
...
...
@@ -123,7 +123,10 @@ public class BackgroundGeolocationService extends Service implements GoogleApiCl
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
instance
=
this
;
EventBus
.
getDefault
().
register
(
this
);
EventBus
eventBus
=
EventBus
.
getDefault
();
if
(!
eventBus
.
isRegistered
(
this
))
{
eventBus
.
register
(
this
);
}
// Load config settings
SharedPreferences
settings
=
getSharedPreferences
(
TAG
,
0
);
...
...
@@ -348,7 +351,9 @@ public class BackgroundGeolocationService extends Service implements GoogleApiCl
startTone
(
"long_beep"
);
// set our stationaryLocation
stationaryLocation
=
LocationServices
.
FusedLocationApi
.
getLastLocation
(
googleApiClient
);
EventBus
.
getDefault
().
post
(
new
StationaryLocation
(
stationaryLocation
));
if
(
stationaryLocation
!=
null
)
{
EventBus
.
getDefault
().
post
(
new
StationaryLocation
(
stationaryLocation
));
}
}
}
}
...
...
@@ -579,9 +584,12 @@ public class BackgroundGeolocationService extends Service implements GoogleApiCl
private
void
cleanUp
()
{
instance
=
null
;
EventBus
.
getDefault
().
unregister
(
this
);
removeActivityUpdates
();
removeLocationUpdates
();
googleApiClient
.
disconnect
();
if
(
googleApiClient
!=
null
&&
googleApiClient
.
isConnected
())
{
removeActivityUpdates
();
removeLocationUpdates
();
googleApiClient
.
disconnect
();
}
}
/**
...
...
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