Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pelias/pelias-android-sdk
Android sdk for pelias
https://github.com/pelias/pelias-android-sdk
android android-development android-library geocoder geocoder-library geocoding geolocation java location location-based pelias reverse-geocoding search
Last synced: 3 months ago
JSON representation
Android sdk for pelias
- Host: GitHub
- URL: https://github.com/pelias/pelias-android-sdk
- Owner: pelias
- License: other
- Created: 2014-04-01T21:37:11.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-11-27T21:50:58.000Z (about 7 years ago)
- Last Synced: 2024-04-14T09:58:54.299Z (10 months ago)
- Topics: android, android-development, android-library, geocoder, geocoder-library, geocoding, geolocation, java, location, location-based, pelias, reverse-geocoding, search
- Language: Java
- Homepage:
- Size: 406 KB
- Stars: 20
- Watchers: 23
- Forks: 5
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Pelias Android SDK
==================Android SDK for Pelias
[![Circle CI](https://circleci.com/gh/pelias/pelias-android-sdk.svg?style=svg&circle-token=6e6203a065375a8fb6fabb5a689c11dcd8fa78cf)](https://circleci.com/gh/pelias/pelias-android-sdk)
## Usage
Pelias Android SDK is a client-side Java wrapper for Pelias plus Android specific integrations.
### Initialization
The `Pelias` class provides a simple interface to the [Pelias geocoder](https://github.com/pelias/pelias) which can be included in your application.
```java
Pelias pelias = new Pelias();
```### Suggest
The suggest endpoint provides fast type-ahead autocomplete results.
```java
pelias.suggest("term to search", lat, lon, Callback);
```### Search
The search endpoint provides locally and globally relevant full-text search results for addresses and POIs.
```java
pelias.search("term to search", lat, lon, Callback);
```### Custom Endpoint
If you have [deployed your own instance of Pelias][2] you can set it on the class before initializing.
```java
Pelias pelias = new Pelias("https://your-pelias-domain.com");
```### Testing
The current strategy for testing involves mocking the service instance using a [Retrofit](https://github.com/square/retrofit) interface which describes the paths to the API.
```java
package com.mapzen.android;import org.mockito.Mockito;
public class TestPelias extends Pelias {
public TestPelias(PeliasService service) {
super(service);
}
private class TestPeliasService implements PeliasService {
@Override public Call getSuggest(@Query("text") String query,
@Query("focus.point.lat") double lat, @Query("focus.point.lon") double lon) {
return new TestCall();
}
..
}
private class TestCall implements Call {
@Override public Response execute() throws IOException {
return Response.success(new Result());
}@Override public void enqueue(Callback callback) {
callback.onResponse(null, Response.success(new Result()));
}
}
}
```## Install
#### Download Jar
Download the [latest AAR][1].
#### Maven
Include dependency using Maven.
```xml
com.mapzen.android
pelias-android-sdk
1.3.1```
#### Gradle
Include dependency using Gradle.
```groovy
compile 'com.mapzen.android:pelias-android-sdk:1.3.1'
```[1]: http://search.maven.org/remotecontent?filepath=com/mapzen/android/pelias-android-sdk/1.3.1/pelias-android-sdk-1.3.1.aar
[2]: https://github.com/pelias/pelias#how-can-i-install-my-own-instance-of-pelias