Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-content/plugins/qtranslate-x/qtranslate_frontend.php on line 497

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-content/themes/goblog/inc/options/ReduxCore/extensions/customizer/extension_customizer.php on line 320

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-content/themes/goblog/inc/options/ReduxCore/extensions/customizer/extension_customizer.php on line 334

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-content/themes/goblog/inc/options/ReduxCore/extensions/customizer/extension_customizer.php on line 360

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-content/themes/goblog/inc/options/ReduxCore/extensions/customizer/extension_customizer.php on line 372

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-content/themes/goblog/inc/options/ReduxCore/extensions/customizer/extension_customizer.php on line 391

Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference, value given in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-includes/class-wp-hook.php on line 286
API | XINFO Blog
Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference, value given in /kunden/438911_85764/webseiten/xinfo/blog/wordpress/wordpress/wp-includes/class-wp-hook.php on line 286

API Archive

If you are looking for a way to implement location based services within your android application without using the web services of Google, you might be interested in the CloudMade web services. These web services provide functions like geocoding, searching for objects which are close to a given coordinate, retrieving map tiles as images and even to create a full route from a start point via several transit points to an end point.

To provide these services, CloudMade relies on the collaborative OpenStreetMap (OSM) project which follows the same principles as Wikipedia to create a free map.

To ensure an easy usage of the web services, CloudMade provides several libraries for the iPhone and other programming languages. The provided Java API is using an old implementation of the Apache HTTP Client which makes it unusable for Android devices. That’s why I’ve created a port of the lightweight CloudMade Java API which can be used on android devices.

The core of this library is the com.appsolut.api.cloudmade.CMClient which hides the HTTP communication of the different calls from the developer. The methods within this class are well documented and I will only give short overview of the most important methods:

public GeoResults find(String query, int results, int skip, BBox bbox, boolean bboxOnly, boolean returnGeometry, boolean returnLocation)

This method provides the geocoding functionality:

public GeoResult findClosest(String object_type, Point point) throws ObjectNotFoundException

If you want to find a certain object which is close to a point you can use this method:

public byte[] getTile(double latitude, double longitude, int zoom, int styleId, int size)

This method will return a png image of a map tile. For example, this might return a tile which looks like the following:

 

An example tile retrieved from the CloudMade web service

public Route route(Point start, Point end, RouteType routeType, List<Point> transitPoints, RouteTypeModifier typeModifier, String lang, MeasureUnit units) throws RouteNotFoundException

Using this method it is possible to create a route.

There exists also an android test project which can be used to ensure that everything works fine. You can also take a look at the test cases to see an example of how to use the library.

You can download or browse the source code at our repository at Google Code (http://code.google.com/p/android-cloudmade-api/) or use svn to check it out.

For more information you can refer to the following links:

If you are having trouble with this port feel free to ask questions.

Please Note:
It is important that you create your own API key when you are using the CloudMade web services. Please refer to the CloudMade FAQ for more information on this topic.

by Kevin Kratzer

When developing Apps for the Android OS you might end up in the situation where you have common Activities or Services which could be reused in multiple Apps with just a little modification. As you don’t want to copy these classes into every single project – which would lead to a hardly maintainable code – you would seek a way to reference the source of these classes from multiple projects. For non-android applications an approach for this problem would be to break up the code into multiple libraries so that the required functionality can be referenced from multiple projects. As long as you are not interacting with external resources this attempt is also possible in Android projects (build a jar and reference it from the projects). But if you are using external resources these classes can’t be used within a library. This is caused by the fact that the Android SDK won’t generate matching ids within the “R” class for external resources which are included in a referenced jar file. In this post I want to show you different solutions for this problem which can avoid the necessity to copy the source code into the projects.