Permalink
Browse files

Update for OpenXC Android library v6.0.0.

Only two changes, addListener and removeListener no longer throw any
exceptions UnrecognizedMeasurementTypeException anymore.
  • Loading branch information...
peplin committed Nov 1, 2014
1 parent 721bc3c commit 72aae8a529c506384185b41fd90fd753c350b5cc
Showing with 21 additions and 20 deletions.
  1. +12 −4 README.mkd
  2. +9 −16 src/com/openxc/openxcstarter/StarterActivity.java
View
@@ -1,7 +1,15 @@
OpenXCStarter
==============
This is a simple "hello world" project. Follow the OpenXC getting started app
[tutorial](http://openxcplatform.com/getting-started/tutorial.html) to learn
more about what this code does. You can also use this project to jumpstart your
own OpenXC app.
This is a simple "hello world" project using OpenXC. Follow the OpenXC getting
started app [tutorial](http://openxcplatform.com/getting-started/tutorial.html)
to learn more about what this code does. You can also use this project to
jumpstart your own OpenXC app.
This version of the project requires v6.0.0 or later of the OpenXC Android
library.
## License
Copyright (c) 2011-2013 Ford Motor Company
Licensed under the BSD license.
@@ -39,13 +39,10 @@ public void onPause() {
// sure to unbind from the service to avoid leaking memory
if(mVehicleManager != null) {
Log.i(TAG, "Unbinding from Vehicle Manager");
try {
// Remember to remove your listeners, in typical Android
// fashion.
mVehicleManager.removeListener(EngineSpeed.class, mSpeedListener);
} catch (VehicleServiceException e) {
e.printStackTrace();
}
// Remember to remove your listeners, in typical Android
// fashion.
mVehicleManager.removeListener(EngineSpeed.class,
mSpeedListener);
unbindService(mConnection);
mVehicleManager = null;
}
@@ -89,8 +86,10 @@ public void run() {
};
private ServiceConnection mConnection = new ServiceConnection() {
// Called when the connection with the VehicleManager service is established, i.e. bound.
public void onServiceConnected(ComponentName className, IBinder service) {
// Called when the connection with the VehicleManager service is
// established, i.e. bound.
public void onServiceConnected(ComponentName className,
IBinder service) {
Log.i(TAG, "Bound to VehicleManager");
// When the VehicleManager starts up, we store a reference to it
// here in "mVehicleManager" so we can call functions on it
@@ -102,13 +101,7 @@ public void onServiceConnected(ComponentName className, IBinder service) {
// have an EngineSpeed.Listener (see above, mSpeedListener) and here
// we request that the VehicleManager call its receive() method
// whenever the EngineSpeed changes
try {
mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
} catch (VehicleServiceException e) {
e.printStackTrace();
} catch (UnrecognizedMeasurementTypeException e) {
e.printStackTrace();
}
mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
}
// Called when the connection with the service disconnects unexpectedly

0 comments on commit 72aae8a

Please sign in to comment.