Hi Jon. I believe Tom Opgenorth is cleaning up the XML them up and rewriting the tutorial based on the example I posted.
Jeremy -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jonathan Pryor Sent: Friday, September 14, 2012 4:33 PM To: Discussions related to Mono for Android Subject: Re: [mono-android] If anyone needs to get osmdroid JAR bindings working here's how Would you mind forking the monodroid-samples repository, adding your sample, and submitting a pull request? :-) http://github.com/xamarin/monodroid-samples Thanks, - Jon On Sep 6, 2012, at 10:04 AM, Jeremy A. Kolb - ARA/NED <[email protected]> wrote: > I'm posting this here because I don't know where else to post it. It may > prove useful to someone. I had a hard time figuring out what to place in > Metadata.xml because the documentation isn't the greatest. There may be a > better way to do this. There are also a bunch of cleanups that could be > performed (ie changing getX() to a property get but I couldn't figure out how > to do that). > > 1. Setup your project as specified in > http://docs.xamarin.com/android/tutorials/Binding_a_Java_Library_%28.jar%29 > (I called it OsmDroid) > 2. Add the following Jars: > a. osmdroid-android-3.0.8 as the input jar > b. httpmime-4.2.1 as reference jar > c. osmdroid-third-party-3.0.8 as reference jar > d. slf4j-android-1.5.8 as reference jar > 3. In EnumMethods.xml you will want the following: > > <mapping jni-interface="org/osmdroid/api/IMapView"> > <method jni-name="setBackgroundColor" parameter="p0" > clr-enum-type="Android.Graphics.Color" /> > </mapping> > > <mapping jni-interface="org/osmdroid/api/IMyLocationOverlay"> > <method jni-name="onStatusChanged" parameter="p1" > clr-enum-type="Android.Locations.Availability" /> > </mapping> > > 4. Metadata.xml: > > <attr > path="/api/package[@name='org.osmdroid.tileprovider.modules']/class[@name='MapTileModuleProviderBase.TileLoader']" > name="visibility"> > public > </attr> > <attr > path="/api/package[@name='org.osmdroid.tileprovider.modules']/class[@name='MapTileModuleProviderBase.TileLoader']/method[@name='loadTile']" > name="visibility"> > public > </attr> > > <attr > path="/api/package[@name='org.osmdroid.tileprovider']/class[@name='MapTileProviderBase.ScaleTileLooper']/method[@name='handleTile']" > name="visibility"> > public > </attr> > <attr > path="/api/package[@name='org.osmdroid.tileprovider']/class[@name='MapTileProviderBase.ZoomInTileLooper']/method[@name='handleTile']" > name="visibility"> > public > </attr> > <attr > path="/api/package[@name='org.osmdroid.tileprovider']/class[@name='MapTileProviderBase.ZoomOutTileLooper']/method[@name='handleTile']" > name="visibility"> > public > </attr> > > > <!-- Draw() seems to be public for android so we need to be consistent > about it. C# doesn't like to mix visibility during inheritance. --> > <attr > path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='Overlay']/method[@name='draw']" > name="visibility"> > public > </attr> > <attr > path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='TilesOverlay']/method[@name='draw']" > name="visibility"> > public > </attr> > <attr > path="/api/package[@name='org.osmdroid.views.overlay']/class[@name='PathOverlay']/method[@name='draw']" > name="visibility"> > public > </attr> > > <remove-node > path="/api/package[@name='org.osmdroid.tileprovider.tilesource']/class[@name='CloudmadeTileSource']" > /> > > <!-- Return IMapController in MapView.Controller so that we match IMapView. > --> > <attr > path="/api/package[@name='org.osmdroid.views']/class[@name='MapView']/method[@name='getController']" > name="managedReturn"> > Org.Osmdroid.Api.IMapController > </attr> > > <!-- We need to rename class MapView.Projection because it conflicts with a > property of the same name --> > <attr > path="/api/package[@name='org.osmdroid.views']/class[@name='MapView.Projection']" > name="managedName"> > MapView.ProjectionImpl > </attr> > > <!-- Change return type to match IMapView.Projection property return type > --> > <attr > path="/api/package[@name='org.osmdroid.views']/class[@name='MapView']/method[@name='getProjection']" > name="managedReturn"> > Org.Osmdroid.Api.IProjection > </attr> > > > This should get you building and you can reference the OsmDroid project in > your application (you don't need to use a MapActivity, a regular one works > just fine) and it will work. > > Jeremy > _______________________________________________ > Monodroid mailing list > [email protected] > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid _______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid _______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
