Points of interest (POI)
The core component of Navmii SDK used to for POI management is PoiManager.
Creating POI manager
Sdk
class contains getPoiManager
method which allows the Navmii SDK user to access the POI manager instance.
Importing custom POI categories
When importing POI categories, it is possible to overwrite the existing ones (including the categories that come preinstalled with the SDK) by using the same identifiers. For the complete list of preinstalled categories and their identifiers please refer to this page.
PoiManager
contains importPoiCategories()
method, that can be used to import custom POI categories or modify the existing ones. It accepts a list of list of CustomPoiCategory
objects.
To create a CustomPoiCategory
object, use CustomPoiCategory.Builder
as follows:
final int categoryId = 20000;
CustomPoiCategory category =
new CustomPoiCategory.Builder(
categoryId, "Custom category 1", ContextCompat.getDrawable(this, R.drawable.category_1))
.build();
CustomPoiCategory.Builder
allows setting the following properties of the category:
identifier
name
image
whether the category should be displayed on the map by default (optional,
true
by default)the default zoom level (optional,
12
by default)the default scale (optional,
1.0f
by default)
After the category has been created, it can be imported using the aforementioned method:
ArrayList<CustomPoiCategory> categories = new ArrayList<>(Collections.singletonList(category));
Sdk.getInstance().getPoiManager().importPoiCategories(categories, new ImportPoiCategoriesListener() {
@Override
public void onSucceeded() {
Log.d("", "Import succeeded");
}
@Override
public void onFailed() {
Log.d("", "Import failed");
}
});
Removing POI categories
It’s also possible to remove any category (either imported or preinstalled) by its identifier using PoiManager.removePoiCategories()
method:
Sdk.getInstance().getPoiManager().removePoiCategories(new ArrayList<>(Collections.singletonList(categoryId)), new RemovePoiCategoriesListener() {
@Override
public void onSucceeded() {
Log.d("", "Category removed");
}
@Override
public void onFailed() {
Log.d("", "Failed to remove");
}
});