Google Maps for Android

Made good progress on this today. I had fiddled with it a bit last year, but had not gotten around to it for a long time and expected all to be lost, but not so.

This is roughly the learning approach that I used:

Here is the Google page for location and maps. I worked along with the simple example and soon got it working. Make sure GPS is enabled on your emulator (if you are using one) - think this is the default, but you never know what the story will be with other emulator packages.

Next is Hello, MapView. Same drill, work through it and bit by bit it gets ironed out.

Then I reviewed the documentation on the Google API for Android. All of these classes concern maps, but there is supposed to be other stuff to the APIs. Not sure how this works out.

Ok, maybe it was not that linear, a bit of scrambling all over the place at the beginning until I knew where I was.
I am paranoid about leaving sensors and other juice gobblers running inadvertently, so I took some time to go through the code and make sure I was doing the right stuff in onPause as well as in onResume. Hopefully all is well. I will know soon enough if these test apps eat my phone battery in a short while :) Speaking of battery consumption, I am planning on putting together some sort of battery monitor which I can hook into my apps in development. Hopefully this will give me some insight into what period to use on the GPS location checks and the like.

Yesterday I wrote a small app to log the users location in a database. I combined that with today's mapping stuff to get an overlay with all of the visited points on it. If there are a lot of points everything seemed to go pear shaped, but with just a few points it worked fine. Need to fine tune this, but it is looking very good for such a small amount of time input.

As an aside to troubleshoot the 'too many points' problem I used the limit clause of sqlite. This goes at the end - limit 10 for example and just returns the first n rows. Bit dangerous in production, but handy for this sort of stuff.

Comments

Popular posts from this blog

Building a choropleth map for Irish agricultural data

Early Stopping with Keras

AutoCompleteTextView backed with data from SQLite in Android