Minor cleanup of service class
Этот коммит содержится в:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 - 2014 Anton Tananaev (anton.tananaev@gmail.com)
|
* Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -31,10 +31,7 @@ import android.os.PowerManager.WakeLock;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
public class TrackingService extends Service implements PositionProvider.PositionListener {
|
||||||
* Background service
|
|
||||||
*/
|
|
||||||
public class TrackingService extends Service {
|
|
||||||
|
|
||||||
public static final String LOG_TAG = "Traccar.TrackingService";
|
public static final String LOG_TAG = "Traccar.TrackingService";
|
||||||
|
|
||||||
@@ -74,7 +71,7 @@ public class TrackingService extends Service {
|
|||||||
clientController = new ClientController(this, address, port, ProtocolFormatter.createLoginMessage(id));
|
clientController = new ClientController(this, address, port, ProtocolFormatter.createLoginMessage(id));
|
||||||
clientController.start();
|
clientController.start();
|
||||||
|
|
||||||
positionProvider = new PositionProvider(this, provider, interval * 1000, positionListener);
|
positionProvider = new PositionProvider(this, provider, interval * 1000, this);
|
||||||
positionProvider.startUpdates();
|
positionProvider.startUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,8 +107,6 @@ public class TrackingService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PositionProvider.PositionListener positionListener = new PositionProvider.PositionListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionUpdate(Location location) {
|
public void onPositionUpdate(Location location) {
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
@@ -120,6 +115,4 @@ public class TrackingService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user