Saturday, March 23, 2013

MySpeed 2.0.2

I've released version 2.0.2 of MySpeed.

There's a fix to improve the routing: I added routing in 2.0.0 and it would only alert for cameras that are on your route. The trouble with that is that if you yourself weren't on the route then it wouldn't alert for cameras that you drive past. So for this version I changed it so that it would alert for cameras in the following three situations:
1. there's no route given.
2. there is a route, you are on the route, and the camera is on the route.
3. there is a route, you are not on the route (irrelevant whether camera is or not).

It only checks whether you're on the route every 30 seconds, and the definition of "you are on the route" is that your current position has an accuracy better than 100m and you are within 200m of the route.

The other change in this release is a performance improvement. I'm always trying to improve the performance because it's doing quite a lot of work. There are very many location updates, and every time MySpeed receives a location update it has to recalculate a lot of stuff. The main change in this release is described below.

MySpeed draws the tracks, the route and the cameras in MyLocationOverlay.draw. The trouble is that this gets called very often - much more often than the location changes. So I need a way to only recalculate what to draw when necessary. In the previous versions of MySpeed I created a Bitmap every time the location changes and then drew the track, route and cameras onto that Bitmap. Then I draw the same Bitmap every time "draw" is called (until the location changes, then I calculate a new Bitmap). For this release I replaced Bitmap with Picture which is much more efficient.


What's next for MySpeed?

I already started working on an OpenStreetMap view for MySpeed as an alternative to the Google map view. I got fairly far along the path for this, but along the way I did a lot of refactoring to make the code more flexible so that it can handle both views. I decided to go back to the 2.0.1 code base and do the refactoring there. This is what you've now got in 2.0.2. Next I will do the OpenStreetMap view again.