Sorry, you need to enable JavaScript to visit this website.

Location Parser

Location Parser

It is a tool for parsing location from various sources.
By default it allows to parse location shared from Google Maps app in two cases:

  • when device is offline and non-POI location is selected

  • when latitude and longitude are available

More precisely supported use cases are:

  1. No Internet connection is available - dropped pin

  2. Place data included in the redirect URL in the data section

  3. Location as a query parameter

  4. Location not available as the POI data is shared

Parse location

To create parser you just need to instantiate LocationParser:

val parser = LocationParser()

Optionally, you can create & use custom parsing strategy:

To do so, you have to implement the ParseStrategy interface and add it as a first or last one to the parser.
If you specify that your custom strategy is the 'First' then every time it will succeed
it will NOT execute other strategies.

val customStrategy = ...
parser.addStrategyFirst(customStrategy)

To start parsing process

val parseData = ParseDataFactory.fromGoogleMapsIntentData(locationData)

parser.parse(parseData, status = { status ->
        [...]
        when (status) {
            is Success -> doSomethingWith(status.result)
            else -> [...]
        }
        [...]
})

The status is an instance of ParseStatus and the status.result is instance of ParseResult class.

Inside result class you can find data about coordinates and if available the description of the place.



image

Google Maps app

image

Share location dialog

image

Parsing in progress

image

Parsed location at map of Maps SDK for Android

Api Reference

You are here