Hey guys,

I've hacked some codelines which enable any application to contribute
to the OpenStreetMap-Project within 4 simple lines of code.
I thought that the OpenStreetMap-Project could be heavily pushed if
this was applied to a couple of applications.

See tutorial/code/proof here:
> http://www.anddev.org/openstreetmap_android_contributor-t2902.html

Contribution is made with lightweight ArrayList of GeoPoints, which
get asynchronous(unblocking) uploaded to the openstreetmap-servers.
Therefore the user won't take any delaying notice.


These are the simple thing to be done (+ adding the packages to your
project):

1. Put this field to your GPS-Enabled Activity:
     private RouteRecorder mRouteRecorder = new RouteRecorder();

2. Add the following lines to the Implementation of your
LocationListener.onLocationChanged(Location loc):
          public void onLocationChanged(Location loc) {
               if (loc != null)
                    OSMContributor.this.mRouteRecorder.add(loc);
          }

3. Modify the onDestroy() of your Activity, to make it similar to this
one:
     @Override
     protected void onDestroy() {
          super.onDestroy();

          // ...

          try {
 
OSMUploader.uploadAsync(this.mRouteRecorder.getRecordedGeoPoints());
          } catch (IOException e) {
               Log.e(DEBUGTAG, "Error uploading route to
openstreemaps.", e);
          }
     }

Regards, plusminus
http://anddev.org
#  Worlds largest Android Development Community / Tutorials
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to