Java Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
app
config/checkstyle
gradle/wrapper
lib
scripts
.gitignore Add sample module and simple search example activity (#57) Jan 11, 2017
LICENSE License: MIT -> Apache 2.0 Apr 10, 2014
README.md
build.gradle
circle.yml
gradle-mvn-push.gradle
gradle.properties [Gradle Release Plugin] - new version commit: 'pelias-android-sdk-1.2… Nov 27, 2017
gradlew
gradlew.bat
release_checklist.md
settings.gradle

README.md

Pelias Android SDK

Android SDK for Pelias

Circle CI

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 which can be included in your application.

Pelias pelias = new Pelias();

Suggest

The suggest endpoint provides fast type-ahead autocomplete results.

pelias.suggest("term to search", lat, lon, Callback<Result>);

Search

The search endpoint provides locally and globally relevant full-text search results for addresses and POIs.

pelias.search("term to search", lat, lon, Callback<Result>);

Custom Endpoint

If you have deployed your own instance of Pelias you can set it on the class before initializing.

Pelias pelias = new Pelias("https://your-pelias-domain.com");

Testing

The current strategy for testing involves mocking the service instance using a Retrofit interface which describes the paths to the API.

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<Result> 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<Result> {
    @Override public Response<Result> execute() throws IOException {
      return Response.success(new Result());
    }

    @Override public void enqueue(Callback<Result> callback) {
      callback.onResponse(null, Response.success(new Result()));
    }
  }
}

Install

Download Jar

Download the latest AAR.

Maven

Include dependency using Maven.

<dependency>
  <groupId>com.mapzen.android</groupId>
  <artifactId>pelias-android-sdk</artifactId>
  <version>1.3.1</version>
</dependency>

Gradle

Include dependency using Gradle.

compile 'com.mapzen.android:pelias-android-sdk:1.3.1'