Skip to content

Commit 72aae8a

Browse files
committed
Update for OpenXC Android library v6.0.0.
Only two changes, addListener and removeListener no longer throw any exceptions UnrecognizedMeasurementTypeException anymore.
1 parent 721bc3c commit 72aae8a

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

README.mkd

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
OpenXCStarter
22
==============
33

4-
This is a simple "hello world" project. Follow the OpenXC getting started app
5-
[tutorial](http://openxcplatform.com/getting-started/tutorial.html) to learn
6-
more about what this code does. You can also use this project to jumpstart your
7-
own OpenXC app.
4+
This is a simple "hello world" project using OpenXC. Follow the OpenXC getting
5+
started app [tutorial](http://openxcplatform.com/getting-started/tutorial.html)
6+
to learn more about what this code does. You can also use this project to
7+
jumpstart your own OpenXC app.
8+
9+
This version of the project requires v6.0.0 or later of the OpenXC Android
10+
library.
11+
12+
## License
13+
14+
Copyright (c) 2011-2013 Ford Motor Company
15+
Licensed under the BSD license.

src/com/openxc/openxcstarter/StarterActivity.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,10 @@ public void onPause() {
3939
// sure to unbind from the service to avoid leaking memory
4040
if(mVehicleManager != null) {
4141
Log.i(TAG, "Unbinding from Vehicle Manager");
42-
try {
43-
// Remember to remove your listeners, in typical Android
44-
// fashion.
45-
mVehicleManager.removeListener(EngineSpeed.class, mSpeedListener);
46-
} catch (VehicleServiceException e) {
47-
e.printStackTrace();
48-
}
42+
// Remember to remove your listeners, in typical Android
43+
// fashion.
44+
mVehicleManager.removeListener(EngineSpeed.class,
45+
mSpeedListener);
4946
unbindService(mConnection);
5047
mVehicleManager = null;
5148
}
@@ -89,8 +86,10 @@ public void run() {
8986
};
9087

9188
private ServiceConnection mConnection = new ServiceConnection() {
92-
// Called when the connection with the VehicleManager service is established, i.e. bound.
93-
public void onServiceConnected(ComponentName className, IBinder service) {
89+
// Called when the connection with the VehicleManager service is
90+
// established, i.e. bound.
91+
public void onServiceConnected(ComponentName className,
92+
IBinder service) {
9493
Log.i(TAG, "Bound to VehicleManager");
9594
// When the VehicleManager starts up, we store a reference to it
9695
// here in "mVehicleManager" so we can call functions on it
@@ -102,13 +101,7 @@ public void onServiceConnected(ComponentName className, IBinder service) {
102101
// have an EngineSpeed.Listener (see above, mSpeedListener) and here
103102
// we request that the VehicleManager call its receive() method
104103
// whenever the EngineSpeed changes
105-
try {
106-
mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
107-
} catch (VehicleServiceException e) {
108-
e.printStackTrace();
109-
} catch (UnrecognizedMeasurementTypeException e) {
110-
e.printStackTrace();
111-
}
104+
mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
112105
}
113106

114107
// Called when the connection with the service disconnects unexpectedly

0 commit comments

Comments
 (0)