PMPoiClient

class PMPoiClient(context: Context, packageName: String, cfg: PartyConfig = PartyConfigProduction) : PMMessengerClient<PMPoiRequest, PMPoiResponse> , PMPoiIfc

Samples

import android.content.Context
import com.sygic.profi.model.pm.poi.PMPoi
import com.sygic.profi.model.pm.poi.PMPoiLocation
import com.sygic.profi.model.pm.poi.PMPoiPlacesFilter
import com.sygic.profi.model.pm.poi.PMPoiResult
import com.sygic.profi.sdk.party.poi.PMPoiClient
fun main() { 
   //sampleStart 
   // context has to be extracted from Android API
val context: Context = providedContext
// please change XXX below to correct applicationId of installed
// profi-navi-apk, because it depends on customer build
val profiNaviAppId: String = "com.sygic.profi.XXX"
// create client with call back interface
val callbackClient = PMPoiClient(context, profiNaviAppId)

// If a place with ID does not exist it will be inserted
// if a place with ID exists it will update place with provided parameters
val addUpdatePlaces = listOf(
    PMPoi(
        id = "1",
        location = PMPoiLocation(
            latitude = 48.0101,
            longitude = 17.1010,
        ),
        iso = "SK",
        category = "Pretty category",
        // other parameters
    )
)
val deletePlaces = listOf("2", "3") // list of place IDs to delete
callbackClient.updatePlaces(addUpdatePlaces, deletePlaces) { message ->
    if (message.result == PMPoiResult.Success) {
        println("Great, places updated!")
    } else {
        println("Something went wrong with message = ${message.text}")
    }
}

// reindex places / categories
callbackClient.reindex { message ->
    if (message.result == PMPoiResult.Success) {
        println("Places reindex successful!")
    } else {
        println("Something went wrong with message = ${message.text}")
    }
}

// prints inserted custom places using custom filter
callbackClient.getPlaces(PMPoiPlacesFilter(iso = "SK")) { placeList ->
    placeList.forEach { place -> println(place) }
}

// prints all inserted custom places
callbackClient.getPlaces(null) { placeList ->
    placeList.forEach { place -> println(place) }
} 
   //sampleEnd
}

Constructors

Link copied to clipboard
fun PMPoiClient(context: Context, packageName: String, cfg: PartyConfig = PartyConfigProduction)

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun getCategories(callback: (categories: List<PMPoiCategory>) -> Unit)
Link copied to clipboard
open override fun getDynamicData(ids: List<String>?, callback: (dynamicData: List<PMPoiDynamicData>) -> Unit)
Link copied to clipboard
open override fun getPlaces(filter: PMPoiPlacesFilter?, callback: (places: List<PMPoi>) -> Unit)
Link copied to clipboard
open override fun reindex(callback: (msg: PMPoiMsg) -> Unit)
Link copied to clipboard
open override fun updateCategories(addUpdate: List<PMPoiCategory>?, delete: List<String>?, callback: (msg: PMPoiMsg) -> Unit)
Link copied to clipboard
open override fun updateDynamicData(addUpdate: List<PMPoiDynamicData>?, delete: List<String>?, callback: (msg: PMPoiMsg) -> Unit)
Link copied to clipboard
open override fun updatePlaces(addUpdate: List<PMPoi>?, delete: List<String>?, callback: (msg: PMPoiMsg) -> Unit)

Properties