How can i display MapBox tiles on Android ? I tried using it with OSMDroid, and Nutiteq with no success. Is there a android library for MapBox ?
For example i used this code to implement MapBox on OSMDroid : http://blog.spatialnetworks.com/post/2012/07/using-mbtiles-on-android-with-osmdroid
XYTileSource MBTILESRENDER = new XYTileSource("mbtiles", ResourceProxy.string.offline_mode, 1, 20, 256, ".png", "http://example.org/");
DefaultResourceProxyImpl mResourceProxy = new DefaultResourceProxyImpl(this.getApplicationContext());
SimpleRegisterReceiver simpleReceiver = new SimpleRegisterReceiver(this.getActivity());
File f = new File(Environment.getExternalStorageDirectory(), "mymbtilesfile.mbtiles");
IArchiveFile[] files = { MBTilesFileArchive.getDatabaseFileArchive(f) };
MapTileModuleProviderBase moduleProvider = new MapTileFileArchiveProvider(simpleReceiver, MBTILESRENDER, files);
MapTileProviderArray mProvider = new MapTileProviderArray(MBTILESRENDER, null, new MapTileModuleProviderBase[] { moduleProvider });
this.mMapView = new MapView(this, 256, mResourceProxy, mProvider);
But it didn't work, i want to load MbTiles directly from the web.
Edit
Official Mapbox Android SDK is released.
Also, see Mapbox's answer.
To people who downvote, I answered the question before the sdk exists.
=============================================
I think Nutiteq looks pretty promising. Their API has a lot of features. Also, their demo projects are inline commented. You can check out this project. Especially, MBTilesMapActivity might be something that you're looking for. The class shows how to work with mbtiles:
You can also take a look at my toy project which is modified from their demo. Basically, my app allows the user to input a url of a mbtiles file. Then, it downloads the file and loads it to the MapView.
If you really have to stick with OSMDroid, this might be helpful. I haven't had a chance to try it though.
Hope this helps.
Mapbox team has started pre-alfa release of Mapbox maps on Android, so I would like to recommend it, just to try. I assume it's good to know that they have heard prayers of android developers.
Mapbox for Android on Github
OSMDroid is terribly documented, but the way they designed it makes it very flexible and self-explanitory if you look at the implementable methods. Here is how you use Mapbox tiles with OSMDroid as of January 2015.
Quick tip: If you're using Android Studio, use break points to get the value of any variable. This helps with debugging and understanding unfamiliar code. That's how I figured out that getTileURLString() returns the full URL of the tile.
Did you know that with the Google Maps API v2, you can use your own tiles provider?
See TileProvider and UrlTileProvider.
The best way to use Mapbox on Android is the Mapbox Android SDK! It's the official codebase, an open source project that supports vector tiles, map animation, and a bunch else - and it's also designed to be easy to transition to from the system default maps.
Re:
Since an MBTiles file is a bundle of tiles that's usually quite large - and can't be requested individually - you usually won't load it directly just to show a map. The approach that the SDK takes is dynamic caching, as shown in this example. The example uses Mapbox, but the caching mechanism is general and would work with any tile server.
Disclosure: I work for Mapbox, and occasionally work on the core of our native code, including the Android SDK.