Language
Mobile SDK Guide
  1. Quick Start
    1. Add the OneAtlas SDK to Your Project
    2. Sample Code

Quick Start

Add the OneAtlas SDK to Your Project

Add the following repository and dependency to your gradle configuration.

...
    allprojects {
        repositories {
            ...
            maven { url 'https://mobile.oneatlas.airbus.com/artifactory/gradle-release/' }
        }
    }

    ...

    dependencies {
        ...
        implementation 'com.airbus.oneatlas:oneatlas:1.0.0'
    }
...

Sample Code

The sample code below will help you execute those simple steps:

  • Authenticate with your API key
  • Create a simple filter based on a location
  • Perform a Feature search into the Living Library
  • Retrieve the WMTS template URL from the Feature

Authenticate with Your API Key

OneAtlas.getInstance().login("<your_api_key>", "IDP", () -> {
    // SDK authentication successful
}, exception -> {
    // Error management
});
OneAtlas.getInstance().login("<your_api_key>", "IDP", {
    // SDK authentication successful
}, { exception ->
    // Error management
})

Create a Simple Filter Based On a Location

SearchFilter filter = new SearchFilter.Builder()
        .setGeometry(new Point(43.0, 3.0))
        .build();
SearchSort sortBy = new SearchSort.Builder()
        .sortByAcquisitionDate(SortOrder.DESCENDING)
        .build();
val filter = SearchFilter.Builder()
        .setGeometry(Point(43.0, 3.0))
        .build()
val sortBy = SearchSort.Builder()
        .sortByAcquisitionDate(SortOrder.DESCENDING)
        .build()

Perform a Feature Search Into the Living Library

OneAtlas.getInstance().getSearchService().openSearch(1, 10, filter, OneAtlas.LIVING_LIBRARY_WORKSPACE_ID, sortBy, page -> {
    // Handle your search results
    List<Feature> features = page.getItems();
}, exception -> {
    // Error management
});
OneAtlas.getInstance().searchService.openSearch(1, 10, filter, OneAtlas.LIVING_LIBRARY_WORKSPACE_ID, sortBy, { page ->
    // Handle your search results
    val features = page.items
}, { exception ->
    // Error management
})

Retrieve the WMTS Template URL from the Feature

ProductFeature feature = ... // Get the feature from the search results
OneAtlas.getInstance().getViewService().getProductFeatureCapabilities(feature, capabilities -> {
    // Access the WMTS URL
    String wmtsUrl = capabilities.getContents().getLayer("default").getResourceUrl();
}, exception -> {
    // Error management
});
val feature = ... // Get the feature from the search results
OneAtlas.getInstance().viewService.getProductFeatureCapabilities(feature, { capabilities ->
    // Access the WMTS URL
    val wmtsUrl = capabilities.contents.getLayer("default")!!.resourceUrl
}, { exception ->
    // Error management
})