IMPORTANT: BINTRAY SHUTTING DOWN
Although the library is no longer maintained, due to Bintray repository service shutting down, we have moved the repository our own repository manager available here. Please see the 'Adding the SDK' section for updated repository URL.
IMPORTANT: LIBRARY DEPRECATED
This library is no longer maintained and was superseeded by a new library, documentation available here.
Introduction
Welcome to the Proximi.io Android Map reference. You can use this library to easily hook up Proximi.io with a map in your Android application.
Features include:
- Floor plan images
- Positioning
- Markers for inputs and geofences
- Directions
- Auto-rotation with magnetometer
- Floor changing / multiple floor support
- GeoJSON support
- Optional Google Maps
You can find the Android SDK reference here. You should understand the basics before using this map library.
Code samples can be found on the right side of the page.
Prerequisites
Proximi.io Android SDK
- Version 0.4+ of this library requires a Proximi.io Android SDK version of 2.7+.
- Version 0.5+ of this library requires a Proximi.io Android SDK version of 2.7.4+.
- Version 0.6.0+ of this library requires a Proximi.io Android SDK version of 2.8.0+.
If you are using an older version, please upgrade before proceeding.
Multidex
This SDK requires the use of multidexing.
Please set up your application to use multidex, as guided here.
Adding the SDK
android {
...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'lib/armeabi/libcpaJNI.so'
exclude 'lib/armeabi/libsqlcipher.so'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
...
// Bintray repository service is shutting down, use our new repo bellow
// maven {
// url "http://proximi-io.bintray.com/proximiio-android"
// }
// Our new repository to replace bintray
maven {
url "https://maven.proximi.io/repository/android-releases/"
}
maven {
url "http://indooratlas-ltd.bintray.com/mvn-public"
}
maven {
url "https://maven.google.com"
}
}
dependencies {
...
implementation 'io.proximi.proximiiolibrary:proximiiomap:0.6.1'
}
Add the following to your module's build.gradle
file.
(Just replace the version number in the build.gradle
with the latest version.)
If you are using a build system other than Gradle, please see Bintray’s instructions to setting things up. (Big blue “Set me up!” -button). You also need to make the other repositories available in a similar fashion.
Getting Started
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<io.proximi.proximiiomap.ProximiioMapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Add the ProximiioMapView
component in your Activity
layout. Please take note of the ID used.
Java
public class MainActivity extends AppCompatActivity {
private ProximiioAPI proximiioAPI;
private ProximiioMapHelper mapHelper;
private static final String TAG = "MainActivity";
private static final String AUTH = "AUTH_KEY_HERE"; // TODO: Replace with your own!
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initialize Proximi.io Android SDK, it's fine if you do this elsewhere, like in the SDK docs.
ProximiioOptions options = new ProximiioOptions()
.setNotificationMode(ProximiioOptions.NotificationMode.ENABLED);
proximiioAPI = new ProximiioAPI(TAG, this, options);
proximiioAPI.setAuth(AUTH, true);
proximiioAPI.setActivity(this);
ProximiioMapView mapView = (ProximiioMapView)findViewById(R.id.map);
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState).build();
}
@Override
protected void onStart() {
super.onStart();
proximiioAPI.onStart();
mapHelper.onStart();
}
@Override
protected void onResume() {
super.onResume();
mapHelper.onResume();
}
@Override
protected void onPause() {
super.onPause();
mapHelper.onPause();
}
@Override
protected void onStop() {
super.onStop();
proximiioAPI.onStop();
mapHelper.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
mapHelper.onDestroy();
// If you want to use Proximi.io on the background or in other Activities, use
// proximiioAPI.destroy();
// instead. For the purposes of a map, we don't need background functionality,
// so it's fine to shut down. Please call destroy/destroyService in the corresponding
// Activity life cycle call related to where you initialize Proximi.io,
// eg. initialize/destroy in onCreate/onDestroy, onStart/onStop, onResume/onPause.
proximiioAPI.destroyService(false);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mapHelper.onSaveInstanceState(outState);
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapHelper.onLowMemory();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
proximiioAPI.onActivityResult(requestCode, resultCode, data);
mapHelper.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
proximiioAPI.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
First, in the onCreate
method of your Activity
, we create a new instance of ProximiioAPI
, and set our auth key and activity.
Next, we'll use the Activity
's findViewById
method to find the ProximiioMapView
, with the ID we specified in the XML.
With this, we can create our ProximiioMapHelper
instance. We'll supply the Builder
constructor with an ID, an Activity
, ProximiioMapView
, auth key, and the savedInstanceState
that's passed to the onCreate
method.
You can specify additional options by calling methods on the Builder
object if you wish, but here we simply call build
straight away to use default options.
In the Activity
you must override all the life cycle methods, as well as a couple more, and call your ProximiioMapHelper
's corresponding methods.
What Next?
- Take a look at
ProximiioMapHelper
andProximiioMapHelper.Builder
for all configuration options. - Feel free to email support@proximi.io for support, questions, and feedback.
Using Google Maps
If you wish to use Google Maps, please follow the steps below. Please note that this is completely optional.
Prerequisites
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR KEY HERE"/>
Add a Google Maps API key to your project, as instructed here.
The end result should be an API key in your application's AndroidManifest.xml.
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
android:name="io.proximi.proximiiomap.ProximiioGoogleMapView" />
</LinearLayout>
Add a fragment with the class ProximiioGoogleMapView
, instead of ProximiioMapView
.
Java
// Replace this:
ProximiioMapView mapView = (ProximiioMapView)findViewById(R.id.map);
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState).build();
// With this:
ProximiioGoogleMapView mapView = (ProximiioGoogleMapView)getSupportFragmentManager().findFragmentById(R.id.map);
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState).build();
Follow the instructions in the regular Getting Started section, and then replace the map view with the new fragment.
You're now using Google Maps!
ProximiioMapHelper
All Builder
methods are available in the ProximiioMapHelper
object as getters and setters as well, so you can change your features and settings on the fly if you need to.
Setting Custom Map Listeners
Default
// No need to call these if you set your custom listeners with "add" methods instead of "set" in the map object.
mapHelper.getProximiioOnCameraMoveStartedListener().onCameraMoveStarted(reason);
mapHelper.getProximiioOnMapClickListener().onMapClick(point);
Google Maps
mapHelper.getGoogleOnCameraIdleListener().onCameraIdle();
mapHelper.getGoogleOnMarkerClickListener().onMarkerClick(marker);
mapHelper.getGoogleOnCameraMoveStartedListener().onCameraMoveStarted(reason);
If you set your own map listeners listeners, please call the corresponding Proximi.io Map listeners from your own implementations.
Additionally, with both maps, if you use your own My-Location Button, you should implement an OnClickListener
and call ProximiioMapHelper#getOnMyLocationButtonClickListener#onMyLocationButtonClick()
in your implementation.
If you have your own Search-button, you can call ProximiioMapHelper#clickedSearch
to open the default search view.
Listener
This can be used to receive callbacks on map events.
mapReady
public void mapReady(MapboxMap map)
public void mapReady(GoogleMap map)
Use this to directly access the map object if you need to.
changedFloor
public void changedFloor(@Nullable ProximiioFloor floor)
Called when the displayed floor has changed.
This is different from ProximiioListener.changedFloor
, if for example ProximiioMapHelper.floorDown
is used.
geofenceClicked
public void geofenceClicked(ProximiioGeofence geofence)
Called when a geofence is clicked on the map.
inputClicked
public void inputClicked(ProximiioInput input)
Called when an input is clicked on the map.
privacyZoneClicked
public void privacyZoneClicked(ProximiioArea area)
Called when a privacy zone is clicked on the map.
poiClicked
public void poiClicked(ProximiioPOI poi)
Called when a Point of Interest is clicked on the map.
See ProximiioPOI
.
addedPOI
public boolean addedPOI(ProximiioPOI poi)
Called when a Point of Interest is added to the map.
Return false
to discard/remove POI. This can be used to build filtering.
removedPOI
public void removedPOI(ProximiioPOI poi)
Called when a Point of Interest is removed from the map.
directionsRoute
public void directionsRoute(ProximiioMapRoute route)
Called when a directions route is fetched.
See ProximiioMapRoute
.
directionsRouteFinished
public void directionsRouteFinished(RouteEndReason reason)
This is called when an active directions route is removed.
See RouteEndReason
for information about the reasons.
directionsAudioGuideReady
public void directionsAudioGuideReady(TextToSpeech tts)
If you enable directions audio guide, this will be called if it's initialized successfully.
With the provided TextToSpeech
object, you can customize various settings. For more, see Android docs.
directionsAudioGuideUnavailable
public void directionsAudioGuideUnavailable(AudioGuideError error)
If you enable directions audio guide, this will be called if it's unavailable.
See AudioGuideError
.
compassBearing
public void compassBearing(double bearing)
If autoRotateAndFollow
is enabled, this will periodically return the compass bearing used to rotate the map, in degrees.
networkError
public void networkError(NetworkError networkError)
Called if a network error occurs.
See NetworkError
.
ClusterState
An enum representing the clustering mode of markers.
Key | Description |
---|---|
ClusterState.NEVER_CLUSTER | Never cluster markers together. |
ClusterState.ALWAYS_CLUSTER | Always use clustering where suitable. |
ClusterState.USE_APPLICATION | Cluster if the ProximiioApplication.isRemoteMode setting of the current application is true . |
SnapMode
An enum representing the snapping mode of location to directions routes.
Key | Description |
---|---|
SnapMode.ALWAYS | The current location will always try to snap to directions routes. |
SnapMode.DIRECTIONS | The current location will try to snap to directions routes when a directions route is active. |
SnapMode.NEVER | The current location will never be snapped to directions routes. |
RouteEndReason
An enum representing the reason why directions routing ended.
Key | Description |
---|---|
RouteEndReason.CANCELED | The user canceled the route. |
RouteEndReason.FINISHED | The user reached the end of the route. |
RouteEndReason.NEW_ROUTE | A new route was requested to replace the old route. |
RouteEndReason.DESTROYED | The ProximiioMapHelper object is being destroyed and the route is removed as part of the cleanup. |
NetworkError
An enum representing network errors.
Key | Description |
---|---|
NetworkError.AUTH_FAILED | Authorization to routing failed, please check your auth key. |
NetworkError.CONNECTION_ERROR | Connection has failed, please check your Internet connection. |
NetworkError.SERVER_ERROR | Server has encountered an error, please try again later. |
NetworkError.UNKNOWN_ERROR | Unknown error. |
NetworkError.NO_ROUTE | No route found by the directions server. |
NetworkError.PARSE_ERROR | Failed to parse the response from server. |
AudioGuideError
An enum representing audio guide errors.
Key | Description |
---|---|
AudioGuideError.MISSING_LANGUAGE | The specified language isn't available. By default, English is used. |
AudioGuideError.UNKNOWN | An unknown error. |
directionsTo
mapHelper.directionsTo(lat, lon, floorNumber);
public void directionsTo(double lat, double lon, int floorNumber)
If positioning and directions are enabled, request a route to be displayed to the specified location and floor.
removeRoute
mapHelper.removeRoute();
public void removeRoute()
If a directions route is active, remove it.
floorUp
mapHelper.floorUp();
public void floorUp()
Go up one floor. Changes the visible floor to be one floor up from the current.
Floor ordering is guaranteed only if floor numbers (ProximiioFloor.getFloorNumber
) are available.
floorDown
mapHelper.floorDown();
public void floorDown()
Go down one floor. Changes the visible floor to be one floor down from the current.
Floor ordering is guaranteed only if floor numbers (ProximiioFloor.getFloorNumber
) are available.
addPOI
ArrayList<ProximiioPOI> pois = new ArrayList<>();
pois.add(new ProximiioPOI(lat, lon, floorNumber, id, title, description));
mapHelper.addPOI(pois);
public void addPOI(Collection<ProximiioPOI> pois)
Add new Points of Interest to the directions search function.
See ProximiioPOI
and ProximiioMapHelper.Builder#searchButton
.
removePOI
// Previously added POIs
mapHelper.removePOI(pois);
public void removePOI(Collection<ProximiioPOI> pois)
Remove previously added ProximiioPOI
objects.
See ProximiioPOI
and ProximiioMapHelper.Builder#searchButton
.
destroy
@Override
protected void onDestroy() {
super.onDestroy();
mapHelper.destroy();
}
public void destroy()
Call this to clean up.
ProximiioMapHelper.Builder
public Builder(@NonNull String id, @NonNull Activity activity, @NonNull ProximiioMapView proximiioMapView, @NonNull String auth, @Nullable Bundle savedInstanceState)
public Builder(@NonNull String id, @NonNull Activity activity, @NonNull ProximiioGoogleMapView googleMapView, @NonNull String auth, @Nullable Bundle savedInstanceState)
Use this to build a new ProximiioMapHelper
.
Use the methods below to customize the map features. You can chain multiple method calls together before the final call to build
.
All Builder
methods are also available in the ProximiioMapHelper
object as getters and setters for customizing on the fly.
Parameters:
- An ID. ID is used to keep track of this particular instance over the application life cycle. Please use different IDs for different API objects.
- Your
Activity
. - A
ProximiioMapView
or aProximiioGoogleMapView
(see Using Google Maps). - Your Proximi.io auth key. You can find this in your portal under "Applications".
- The
savedInstanceState
Bundle
, as provided by yourActivity
'sonCreate
.
positioning
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.positioning(true)
.build();
public Builder positioning(boolean enabled)
Set the current position of the user automatically on the map, as position gets updated with ProximiioListener.position
.
- This is enabled by default.
directions
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.directions(true)
.build();
public Builder directions(boolean enabled)
Enable or disable directions.
See searchButton
and directionsHelp
.
This requires that you have an account that is eligible for directions.
- This is enabled by default.
- This requires positioning.
autoRotateAndFollow
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.autoRotateAndFollow(true)
.build();
public Builder autoRotateAndFollow(boolean enabled)
Set automatic rotation + following of the current position based on the device's magnetic sensor. If a magnetic sensor is not available, rotation won't be performed.
- This is disabled by default.
- This requires positioning.
followPositioning
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.followPositioning(true)
.build();
public Builder followPositioning(boolean enabled)
Enable or disable the map camera following the current position.
The map camera will stop following the current position if the map is moved around, and will continue following when the "My-Location" -button is tapped.
This has no effect if Builder.autoRotateAndFollow
is set to true
, as it already follows the current position.
- This is enabled by default.
- This requires positioning.
floorID
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.floorID("yourFloorIDhere")
.build();
public Builder floorID(@Nullable String floorID)
Set the floor for the map manually.
- This is null by default (the current floor from
ProximiioListener.changedFloor
is used).
showFloorPlan
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showFloorPlan(true)
.build();
public Builder showFloorPlan(boolean show)
Show the floor plan of the current floor (from ProximiioListener.changedFloor
), or the floor plan of the specified floor ID.
- This is enabled by default.
showFloorIndicator
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showFloorIndicator(true)
.build();
public Builder showFloorIndicator(boolean show)
Show a floor indicator next to the current position, when the floor displayed is different from the actual current floor (but not in a different place).
For example, if the current floor (ProximiioListener.changedFloor
) is floor number 2 and the floor visible is number 1, a small arrow up is displayed to indicate that the current position is above the visible floor.
This is possible, for example, if Builder.floorID
or ProximiioMapHelper.floorUp
is used.
- This is enabled by default.
- This requires positioning.
floorChangeButtons
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.floorChangeButtons(true)
.build();
public void floorChangeButtons(boolean enabled)
If set to true
, two buttons with arrows will be generated, that change the floor currently visible.
- This is enabled by default.
showFloorNumber
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showFloorNumber(true)
.build();
public Builder showFloorNumber(boolean show)
If set to true
, a floor number of the currently visible floor will be displayed next to floor change buttons.
- This is enabled by default.
- This requires floor change buttons.
showInputMarkers
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showInputMarkers(true)
.build();
public Builder showInputMarkers(boolean show)
Show markers of inputs on the map.
- This is enabled by default.
showGeofenceMarkers
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showGeofenceMarkers(true)
.build();
public Builder showGeofenceMarkers(boolean show)
Show markers of geofences on the map. Radius of the geofence is indicated when the marker is tapped.
- This is enabled by default.
showPrivacyZoneMarkers
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showPrivacyZoneMarkers(true)
.build();
public Builder showPrivacyZoneMarkers(boolean show)
Show markers of privacy zones on the map. Radius of the privacy zone is indicated when the marker is tapped.
- This is enabled by default.
Please note that privacyZoneAreaOnly
is enabled by default.
geofenceAreaOnly
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.geofenceAreaOnly(true)
.build();
public Builder geofenceAreaOnly(boolean enabled)
If this is enabled, geofence markers will be hidden and only their areas are shown.
- This is disabled by default.
- This requires geofence markers.
privacyZoneAreaOnly
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.privacyZoneAreaOnly(true)
.build();
public Builder privacyZoneAreaOnly(boolean enabled)
If this is enabled, privacy zone markers will be hidden and only their areas are shown.
- This is enabled by default.
- This requires privacy zone markers.
showFeatures
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showFeatures(true)
.build();
public Builder showFeatures(boolean show)
Show or hide features added in the portal, like stairs, elevators, and POI markers.
- This is enabled by default.
showGeoJSON
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showGeoJSON(true)
.build();
public Builder showGeoJSON(boolean show)
Enable or disable geoJSON added in the portal.
- This is enabled by default.
- This requires features.
showRoutes
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.showRoutes(true)
.build();
public Builder showRoutes(boolean show)
If this is set to true
, directions routes are always visible, even if there is no directions route active.
If this is false, only active directions routes are displayed.
- This is disabled by default.
- This requires features.
routeLineWidth
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.routeLineWidth(10f)
.build();
public Builder routeLineWidth(float pixels)
Set the width of the directions route in pixels.
- This is 5 pixels by default.
- This requires directions.
routeEndDistance
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.routeEndDistance(5)
.build();
public Builder routeEndDistance(double meters)
Set the distance from the route end point at which the route is completed and erased.
- This is 2 meters by default.
- This requires directions.
snapToRoute
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.snapToRoute(ProximiioMapHelper.SnapMode.DIRECTIONS)
.build();
public Builder snapToRoute(SnapMode mode)
This will determine if the current position is snapped to the nearest directions route. See SnapMode.
Please note that the distance from the current position to the nearest directions route must be lower than snapToRouteThreshold
in order for the position to snap to route.
- This is
SnapMode.DIRECTIONS
by default. - This requires directions and features.
snapToRouteThreshold
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.snapToRouteThreshold(5)
.build();
public Builder snapToRouteThreshold(double meters)
Set the radius of the route snapping. Current position won't be set to the current route if it's further from the route than this.
- This is 5 meters by default.
- This requires snapping to route.
defaultPosition
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.defaultPosition(40.712775, -74.005973, 10) // New York
.build();
public Builder defaultPosition(double lat, double lon, double zoom)
Set the camera position of the map when it's initialized.
Please note that this is only available in the Builder
object.
- This is 0, 0, 0 by default.
initialPositioningZoom
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.initialPositioningZoom(false)
.build();
public Builder initialPositioningZoom(boolean enabled)
Enable or disable zooming in on the first user position.
- This is enabled by default.
- This requires positioning.
initialPositioningZoomLevel
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.initialPositioningZoomLevel(20)
.build();
public Builder initialPositioningZoomLevel(float zoomLevel)
Set the zoom level of the map when zooming in on the first user position.
- This is 19.5 by default.
- This requires positioning.
- This requires initialPositioningZoom.
myLocationButton
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.myLocationButton(true)
.build();
public Builder myLocationButton(boolean enabled)
Enable or disable the "My-Location" button.
- This is enabled by default.
- This requires positioning.
searchButton
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.searchButton(true)
.build();
public Builder searchButton(boolean enabled)
Set to true
to create a Search-button to upper left corner of the screen, which opens a searchable list of Points of Interest.
You can create Points of Interest from Proximi.io Geofences and Inputs with geofencePoi
and inputPOI
, as well as add your own with ProximiioMapHelper.addPOI
.
- This is enabled by default.
- This requires directions.
geofencePOI
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.geofencePOI(true)
.build();
public Builder geofencePOI(boolean enabled)
Set to true
to add all Proximi.io Geofences as Points of Interest, so you can request directions to them via the Search-button.
- This is enabled by default.
- This requires directions.
- This requires the Search-button.
inputPOI
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.inputPOI(true)
.build();
public Builder inputPOI(boolean enabled)
Set to true
to add all Proximi.io Inputs as Points of Interest, so you can request directions to them via the Search-button.
- This is disabled by default.
- This requires directions.
- This requires the Search-button.
directionsHelp
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.directionsHelp(true)
.build();
public Builder directionsHelp(boolean enabled)
If set to true
, a help box with route guidance instructions and a cancel-button will be added to the bottom of the screen when a directions route is displayed.
- This is enabled by default.
- This requires directions.
directionsPlayAudioGuide
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.directionsPlayAudioGuide(true)
.build();
public Builder directionsPlayAudioGuide(boolean enabled)
If set to true
, this will enable the directions audio guide. The audio guide will read route guidance instructions aloud.
- This is disabled by default.
- This requires directions.
directionsAccessibility
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.directionsAccessibility(true)
.build();
public Builder directionsAccessibility(boolean enabled)
If this is enabled, directions routes will be calculated with accessibility in mind.
- This is disabled by default.
- This requires directions.
clusterMarkers
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.clusterMarkers(ProximiioMapHelper.ClusterState.NEVER_CLUSTER)
.build();
public Builder clusterMarkers(ClusterState clusterState)
Set the cluster mode of markers.
See ProximiioMapHelper.ClusterState
.
- This is
ClusterState.USE_APPLICATION
by default. - This requires input and/or geofence markers.
includeMarkers
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.includeMarkers(new String[] { "firstMarkerID", "secondMarkerID" })
.build();
public Builder includeMarkers(@Nullable String[] ids)
Set which inputs' and geofences' markers are displayed.
- All markers are displayed by default.
- This requires input and/or geofence markers.
excludeMarkers
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.excludeMarkers(new String[] { "firstMarkerID", "secondMarkerID" })
.build();
public Builder excludeMarkers(@Nullable String[] ids)
Set which inputs' and geofences' markers are not displayed.
- All markers are displayed by default.
- This requires input and/or geofence markers.
inputMarker
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.inputMarker(myBitmap)
.build();
public Builder inputMarker(@Nullable Bitmap bitmap)
Set a custom Bitmap
to use as the input marker. Set to null
to use the default marker.
- This requires input markers.
geofenceMarker
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.geofenceMarker(myBitmap)
.build();
public Builder geofenceMarker(@Nullable Bitmap bitmap)
Set a custom Bitmap
to use as the geofence marker. Set to null
to use the default marker.
- This requires geofence markers.
privacyZoneMarker
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.privacyZoneMarker(myBitmap)
.build();
public Builder privacyZoneMarker(@Nullable Bitmap bitmap)
Set a custom Bitmap
to use as the privacy zone marker. Set to null
to use the default marker.
- This requires privacy zone markers.
routeColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.routeColor(Color.BLUE)
.build();
public Builder routeColor(int argb)
Set the color of the directions route, in ARGB hex (see the Color
class).
- This is
Color.RED
by default. - This requires directions.
inputMarkerColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.inputMarkerColor(Color.BLUE)
.build();
public Builder inputMarkerColor(int rgb)
Set the color of input markers, in RGB hex (see the Color
class).
- This is
Color.BLUE
by default. - This requires input markers.
- This requires default input markers.
geofenceMarkerColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.geofenceMarkerColor(Color.RED)
.build();
public Builder geofenceMarkerColor(int rgb)
Set the color of geofence markers, in RGB hex (see the Color
class).
- This is
Color.RED
by default. - This requires geofence markers.
- This requires default geofence markers.
privacyZoneMarkerColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.privacyZoneMarkerColor(Color.BLACK)
.build();
public Builder privacyZoneMarkerColor(int rgb)
Set the color of privacy zone markers, in RGB hex (see the Color
class).
- This is
Color.BLACK
by default. - This requires privacy zone markers.
- This requires default privacy zone markers.
inputMarkerAreaColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.inputMarkerAreaColor(0xFF0000FF)
.build();
public Builder inputMarkerAreaColor(int argb)
Set the color for input range indicators, in ARGB hex (see the Color
class).
- This is 0xFF0000FF by default.
- This requires input markers.
geofenceMarkerAreaColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.geofenceMarkerAreaColor(0x10FF0000)
.build();
public Builder geofenceMarkerAreaColor(int argb)
Set the color for geofence area, in ARGB hex (see the Color
class).
- This is 0x33FF0000 by default.
- This requires geofence markers.
privacyZoneMarkerAreaColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.privacyZoneMarkerAreaColor(0x10000000)
.build();
public Builder privacyZoneMarkerAreaColor(int argb)
Set the color for privacy zone area, in ARGB hex (see the Color
class).
- This is 0x33000000 by default.
- This requires privacy zone markers.
myLocationButtonColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.myLocationButtonColor(Color.BLUE)
.build();
public Builder myLocationButtonColor(int argb)
Set the "My-Location" button color, in ARGB hex (see the Color
class).
- This is 0x553F51B5 by default.
- This requires the "My-Location" button.
searchButtonColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.searchButtonColor(Color.BLUE)
.build();
public Builder searchButtonColor(int argb)
Set the Search-button color, in ARGB hex (see the Color
class).
- This is 0x553F51B5 by default.
- This requires the Search-button.
floorChangeButtonsColor
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.floorChangeButtonsColor(Color.BLUE)
.build();
public Builder floorChangeButtonsColor(int argb)
- This is 0x553F51B5 by default.
- This requires the floor change buttons.
listener
mapHelper = new ProximiioMapHelper.Builder(TAG, this, mapView, AUTH, savedInstanceState)
.listener(new ProximiioMapHelper.Listener() {
@Override
public void changedFloor(@Nullable ProximiioFloor floor) {
// Floor changed
}
})
.build();
public Builder listener(Listener listener)
Set the listener for map events.
See Listener
.
build
public ProximiioMapHelper build()
Create a new ProximiioMapHelper
object from this Builder
. The new object will begin operation and add specified features to the map.
ProximiioPOI
public ProximiioPOI(double lat, double lon, int floorNumber, @NonNull String id, @NonNull String title, @Nullable String description)
Use ProximiioPOI
to add your own Points of Interest for the Search-button.
See ProximiioMapHelper#addPOI
.
Parameters:
- Latitude
- Longitude
- Floor number. Ground floor is 0.
- ID of this POI. Create a unique one for each POI.
- Title.
- Description.
ProximiioMapRoute
Represents a directions route.
getNodes
public ArrayList<ProximiioMapRouteNode> getNodes()
Returns the nodes of the route, from start to finish.
ProximiioMapRouteNode
Represents a single node of a directions route.
getLat
public double getLat()
Latitude of the node, in WGS84.
getLon
public double getLon()
Longitude of the node, in WGS84.
getFloorNumber
public int getFloorNumber()
Floor number of this node.
getHelpText
public String getHelpText()
Help text for navigation.