Skip to content

Commit

Permalink
Updated service to properly initiate ObdService.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwallington committed Mar 5, 2015
1 parent 4d39e53 commit 3dafa67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/src/main/java/cargo/cargocollector/CollectorService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public class CollectorService extends Service {
private LocationService m_locationService = null;
private SensorService m_sensorService = null;

private ObdService m_obdService = null;

private Context m_context = null;

private boolean m_isRunning = false;

public class CollectorBinder extends Binder {
Expand All @@ -30,6 +34,7 @@ public IBinder onBind(Intent intent) {
@Override
public void onCreate() {
Log.d("CollectorService", "CollectorService created.");
m_context = this;
}

/*
Expand All @@ -52,7 +57,8 @@ public int onStartCommand(Intent intent, int flags, int startId) {
//m_sensorService = new SensorService((SensorManager)getSystemService(SENSOR_SERVICE));

//Activate OBD service
ObdService.start();
m_obdService = new ObdService(m_context);
m_obdService.start();


//Start data aggregator.
Expand Down Expand Up @@ -87,7 +93,7 @@ public void onDestroy() {

//Destroy OBD exceptions.
try {
ObdService.cancel();
m_obdService.stop();
} catch (Exception e) {
Log.d("OBD", "Exception: onDestroy(): " + e.getMessage());
}
Expand Down

0 comments on commit 3dafa67

Please sign in to comment.