4.8.1 version
Table of Contents
- What’s New
- Setup
- Usage
- Offline mode
- Settings сlass
- Functions
- Events
- Festivals
- Navigation
- GlobalLocationProvider
- CrowdConnected location provider
- IndoorAtlas location provider
What’s New in ExpoFP Fplan version 4.8.1
Added new features and events, updated packages from CrowdConnected to version 2.0.2.
Setup
Add Maven repository reference to settings.gradle file(in root of your project):
repositories {
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
//If you want to use navigation from CrowdConnected, add a link to the repository
//maven { url "https://maven2.crowdconnected.net/" }
//If you want to use navigation from IndoorAtlas, add a link to the repository
//maven { url "https://dl.cloudsmith.io/public/indooratlas/mvn-public/maven/" }
...
}
Add dependency to build.gradle file(in module):
dependencies {
implementation 'com.expofp:common:4.8.1'
implementation 'com.expofp:fplan:4.8.1'
//If you want to use navigation from CrowdConnected, add a link to the package
//implementation 'com.expofp:crowdconnected:4.8.1'
//If you want to use navigation from IndoorAtlas, add a link to the package
//implementation 'com.expofp:indooratlas:4.8.1'
...
}
Add permissions in “AndroidManifest.xml” file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Usage
Add FplanView to layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.expofp.fplan.FplanView
android:id="@+id/fplanView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Init FplanView:
Settings settings = new Settings()
//.withLocationProvider(new CrowdConnectedProvider(getApplication(), new com.expofp.crowdconnected.Settings("APP_KEY","TOKEN","SECRET")))
//.withLocationProvider(new IndoorAtlasProvider(getApplication(), "API_KEY", "API_SECRET_KEY"))
//.withGlobalLocationProvider()
.withEventsListener(new FplanEventsListener() {
@Override
public void onFpConfigured() {
}
@Nullable
@Override
public void onFpConfigureError(int errorCode, String description) {
}
@Override
public void onBoothClick(@Nullable FloorPlanBoothBase booth) {
}
@Override
public void onDirection(@Nullable Route route) {
}
@Override
public void onMessageReceived(@Nullable String message) {
}
@Override
public void onDetails(@Nullable Details details) {
}
@Override
public void onBookmarkClick(Bookmark bookmark) {
}
@Override
public void onCategoryClick(Category category) {
}
@Override
public void onExhibitorCustomButtonClick(String externalId, int buttonNumber, String buttonUrl) {
}
@Override
public void onCurrentPositionChanged(Location location) {
}
});
_fplanView = findViewById(R.id.fplanView);
_fplanView.init("https://demo.expofp.com", settings);
Stop FplanView.
After you finish working with FplanView, you need to stop it.
To do this, you need to call the ‘destroy’ function:
_fplanView = findViewById(R.id.fplanView);
_fplanView.destroy();
Offline mode
ExpoFP SDK provides the following offline modes:
1. Preloading a plan into cache. The ‘downloadZipToCache’ method allows to download an offline version of the plan into cache.
Example:
_fplanView.downloadZipToCache("https://demo.expofp.com", new DownloadZipToCacheCallback() {
@Override
public void onCompleted(String htmlFilePath) {
}
@Override
public void onError(String message) {
}
});
‘DownloadZipToCacheCallback.onCompleted’ returns the path to the file in the cache(htmlFilePath), this path is needed to open the plan:
_fplanView.openFile(htmlFilePath, "?noOverlay=true", settings);
Recommended use
It is recommended to run the ‘downloadZipToCache’ function once when starting the application. The ‘downloadZipToCache’ function checks the plan version on the server and if it has changed, it starts downloading. After the download has been successfully completed, the function calls the ‘DownloadZipToCacheCallback.onCompleted’ callback and passes the path to the plan file in the cache. If the plan version has not changed, the ‘downloadZipToCache’ function immediately calls ‘DownloadZipToCacheCallback.onCompleted’ and also passes the path to the plan file in the cache.
package com.example.expofp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.expofp.fplan.FplanView;
import com.expofp.fplan.contracts.DownloadZipToCacheCallback;
public class MainActivity extends AppCompatActivity {
private FplanView _fplanView;
private String _htmlFilePath;
@Override
protected void onDestroy() {
_fplanView.destroy();
super.onDestroy();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_open_plan) {
com.expofp.fplan.models.Settings settings = new com.expofp.fplan.models.Settings();
//We can not wait until the offline version is loaded
//and try to open the plan in the usual way using the 'init' method:
if(_htmlFilePath == null){
_fplanView.init("https://demo.expofp.com", settings);
}
else {
_fplanView.openFile(_htmlFilePath, "?noOverlay=true", settings);
}
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
_fplanView = findViewById(R.id.fplanView);
_fplanView.downloadZipToCache("https://demo.expofp.com", new DownloadZipToCacheCallback() {
@Override
public void onCompleted(String htmlFilePath) {
//Save htmlFilePath
_htmlFilePath = htmlFilePath;
}
@Override
public void onError(String s) {
_htmlFilePath = null;
}
});
}
}
2. Opening a zip archive with a plan - you can download the plan archive from the “Integration options” page (windows section),
add this archive to your application (assets) and then open this plan using the “openZipFromAssets()” function.
Example:
Settings settings = new Settings();
_fplanView = findViewById(R.id.fplanView);
_fplanView.openZipFromAssets("demo.zip", null, settings, getApplicationContext());
You can also open a zip using the “openZip()” function, this allows you to open an archive stored in the device’s memory.
Example:
Settings settings = new Settings();
File zipFile = new File("/mnt/sdcard/demo.zip");
_fplanView = findViewById(R.id.fplanView);
_fplanView.openZip(zipFile, null, settings);
Settings сlass
The Settings class contains all the parameters necessary for the initialization and operation of the plan.
Parameters passed to the constructor
- focusOnLocation(boolean, optional) - a parameter that activates autofollowing the blue dot. If the value of the parameter is true, the plan will follow the blue dot, while the value of the focusOnFirstLocation parameter is ignored. The default value for this parameter is false.
- focusOnFirstLocation(boolean, optional) - a parameter that activates focusing when only the blue dot is displayed for the first time. If the value of the parameter is true, the plan will focus on the blue dot only once when it appears on the map, further behavior of the plan will depend on whether the focusOnLocation parameter is enabled. The default value for this parameter is false.
- loadingTimeout(int, optional) - timeout for loading the plan, after this time has elapsed, FplanView will try to load the offline version or give an error. The default value is 20000 milliseconds.
Settings settings = new Settings(focusOnLocation: false, focusOnFirstLocation: true);
WithEventsListener method
Specifies a subscriber for plan events. Events are described in the Events chapter.
Settings settings = new Settings()
.withEventsListener(new FplanEventsListener() {
@Override
public void onFpConfigured() {
}
@Nullable
@Override
public void onFpConfigureError(int errorCode, String description) {
}
@Override
public void onBoothClick(@Nullable FloorPlanBoothBase booth) {
}
@Override
public void onDirection(@Nullable Route route) {
}
@Override
public void onMessageReceived(@Nullable String message) {
}
@Override
public void onDetails(@Nullable Details details) {
}
@Override
public void onBookmarkClick(Bookmark bookmark) {
}
@Override
public void onCategoryClick(Category category) {
}
@Override
public void onExhibitorCustomButtonClick(String externalId, int buttonNumber, String buttonUrl) {
}
@Override
public void onCurrentPositionChanged(Location location) {
}
});
WithFestivalEventsListener method
Specifies a subscriber for Festival events. Festival events are described in the Festival events chapter.
Settings settings = new Settings()
.withFestivalEventsListener(new FestivalEventsListener() {
@Override
public void onDirectionsClick(String id, String url) {
}
@Override
public void onMoreDetailsClick(String id) {
}
});
WithLocationProvider method
Specifies the location provider. The location provider is described in the Navigation chapter.
Settings settings = new Settings()
.withLocationProvider(new GpsProvider(getApplication()));
WithGlobalLocationProvider method
Specifies that the GlobalLocationProvider should be used. The GlobalLocationProvider is described in the GlobalLocationProvider chapter.
Settings settings = new Settings()
.withGlobalLocationProvider();
Functions
Select booth function
_fplanView.selectBooth("nameOrExternalId");
Select exhibitor function
_fplanView.selectExhibitor("exhibitorName");
Select exhibitors function
_fplanView.selectExhibitor(new String[]{"nace", "ohu-place"});
Highlight exhibitors function
_fplanView.highlightExhibitors(new String[]{"nace", "ohu-place"});
Select category function
_fplanView.selectCategory("categoryName");
Build route function
_fplanView.selectRoute("from", "to");
_fplanView.selectRoute(new SelectRoutePoint(500, 500, "2"), "to");
_fplanView.selectRoute("from", new SelectRoutePoint(500, 500, "2"));
com.expofp.fplan.models.SelectRoutePoint properties:
x(Double) - X
y(Double) - Y
z(String) - Z(layer)
zValueIsDigit(Bool) - Flag indicating whether the value of Z is a digit
latitude(Double) - latitude
longitude(Double) - longitude
Set current position(Blue-dot) function
Location location = new Location(500, 500);
boolean focus = true;
_fplanView.selectCurrentPosition(location, focus);
com.expofp.fplan.models.Location properties:
x(Double) - X
y(Double) - Y
z(String) - Z(layer)
zValueIsDigit(Bool) - Indicates whether the value 'z' is a number
angle(Double) - Direction angle
latitude(Double) - Latitude
longitude(Double) - Longitude
Show/hide layer
String layer = "2";
boolean visible = false;
_fplanView.updateLayerVisibility(layer, visible);
Get visibility
_fplanView.getVisibility(visibility -> {});
Set visibility
_fplanView.setVisibility(new Visibility(false, false, false, false));
com.expofp.fplan.models.Visibility properties:
controls(Bool) - show/hide controls
levels(Bool) - show/hide levels
header(Bool) - show/hide header
overlay(Bool) - show/hide overlay
Find Location
_fplanView.findLocation();
Zoom In
_fplanView.zoomIn();
Zoom Out
_fplanView.zoomOut();
Switch View
_fplanView.switchView();
Fit Bounds
_fplanView.fitBounds();
Set bookmarks
Bookmark[] bookmarks = new Bookmark[] { new Bookmark("PNTA", true) };
_fplanView.setBookmarks(bookmarks);
com.expofp.fplan.models.Bookmark properties:
name(String) - booth name
externalId(String) - External Id
bookmarked(Boolean) - true if bookmarked
Clear floor plan function
_fplanView.clear();
Get exhibitor list
_fplanView.exhibitorsList(exhibitors -> {});
com.expofp.fplan.models.Exhibitor properties:
id(int) - exhibitor id
name(String) - exhibitor name
externalId(String) - exhibitor external id
booths(int[]) - booth ids
Get category list
_fplanView.categoriesList(categories -> {});
com.expofp.fplan.models.Category properties:
id(int) - category id
name(String) - category name
exhibitors(int[]) - exhibitor ids
Get booth list
_fplanView.boothsList(booths -> {});
com.expofp.fplan.models.FloorPlanBooth properties:
id(int) - booth id
name(String) - booth name
externalId(String) - booth external id
isSpecial(Boolean) - true if booth is special
exhibitors(int[]) - exhibitor ids
layer(Layer) - layer info
com.expofp.fplan.models.Layer properties:
name(String) - layer name
description(String) - description
Events
Floor plan ready event
This event is called when the plan initialization process has successfully completed.
@Override
public void onFpConfigured() {
}
Floor plan init error event
This event is called when an error occurs while initializing the plan.
@Nullable
@Override
public void onFpConfigureError(int errorCode, String description) {
}
Select booth event
This event is called when a booth is clicked.
@Override
public void onBoothClick(@Nullable FloorPlanBoothBase booth) {
}
com.expofp.fplan.models.FloorPlanBoothBase properties:
id(String) - booth id
name(String) - booth name
externalId(String) - booth external id
layer(Layer) - layer info
com.expofp.fplan.models.Layer properties:
name(String) - layer name
description(String) - description
Current position changed event
Event called when the position of the Blue-dot changes.
@Override
public void onCurrentPositionChanged(Location location) {
}
com.expofp.fplan.models.Location properties:
x(Double) - X
y(Double) - Y
z(String) - Z(layer)
zValueIsDigit(Bool) - Indicates whether the value 'z' is a number
angle(Double) - Direction angle
latitude(Double) - Latitude
longitude(Double) - Longitude
Route create event
This event is called when the route is successfully built.
@Override
public void onDirection(@Nullable Route route) {
}
com.expofp.fplan.models.Route properties:
from(FloorPlanBoothBase) - start booth
to(FloorPlanBoothBase) - destination booth
distance(String) - information about distances, for example: 15m
time(int) - estimated time to final destination booth in seconds
com.expofp.fplan.models.FloorPlanBoothBase properties:
id(String) - booth id
name(String) - booth name
externalId(String) - booth external id
layer(Layer) - layer info
com.expofp.fplan.models.Layer properties:
name(String) - layer name
description(String) - description
Receive message event
Currently not in use.
@Override
public void onMessageReceived(@Nullable String message) {
}
Details open event
This event is called when opening a panel with information, it can be a panel with information about an open booth, a route, etc.
@Override
public void onDetails(@Nullable Details details) {
}
com.expofp.fplan.models.Details properties:
type(String) - "booth" | "exhibitor" | "route"
id(String) - booth id | exhibitor id | null for route
name(String) - booth name | exhibitor name | null for route
externalId(String) - booth externalId | exhibitor externalId | null for route
boothsNames(String[]) - Booths names
Bookmark click event
This event is called when a Bookmark is bookmarked(unbookmarked).
@Override
public void onBookmarkClick(Bookmark bookmark) {
}
com.expofp.fplan.models.Bookmark properties:
name(String) - booth name
externalId(String) - External Id
bookmarked(Boolean) - true if bookmarked
Category click event
This event is called when a Category is clicked.
@Override
public void onCategoryClick(Category category) {
}
com.expofp.fplan.models.Category properties:
id(int) - category id
name(String) - category name
exhibitors(int[]) - exhibitor ids
Exhibitor custom button click event
This event is called after clicking a custom button in the panel with information about the exhibitor.
@Override
public void onExhibitorCustomButtonClick(String externalId, int buttonNumber, String buttonUrl) {
}
Festivals
Init FplanView
Settings settings = new Settings()
.withFestivalEventsListener(new FestivalEventsListener() {
@Override
public void onDirectionsClick(String id, String url) {
Log.d("Demo", String.format(Locale.US, "[onDirectionsClick] url: '%s'", url));
}
@Override
public void onMoreDetailsClick(String id) {
Log.d("Demo", String.format(Locale.US, "[onMoreDetailsClick] id: '%s'", id));
}
});
_fplanView = findViewById(R.id.fplanView);
_fplanView.init("https://fest-digitalx23.expofp.com/", settings);
Stop FplanView
After you finish working with FplanView, you need to stop it.
To do this, you need to call the ‘destroy’ function:
_fplanView = findViewById(R.id.fplanView);
_fplanView.destroy();
Festival events
‘Directions’ button click event
This event is called after clicking a ‘Directions’ button in the panel with information about the exhibitor.
@Override
public void onDirectionsClick(String id, String url) {
Log.d("Demo", String.format(Locale.US, "[onDirectionsClick] url: '%s'", url));
}
‘More details’ button click event
This event is called after clicking a ‘More details’ button in the panel with information about the exhibitor.
@Override
public void onMoreDetailsClick(String id) {
Log.d("Demo", String.format(Locale.US, "[onMoreDetailsClick] id: '%s'", id));
}
Navigation
[!IMPORTANT] Before using third-party coordinate providers(CrowdConnected or IndoorAtlas), the ‘GPS/IPS from 3rd party’ option must be activated:
There are 2 ways to use navigation in FplanView. The first way is to explicitly specify the provider in the FplanView settings. In this case, FplanView will start and stop the LocationProvider on its own.
LocationProvider locationProvider = ...;
Settings settings = new Settings()
.withLocationProvider(locationProvider);
_fplanView = findViewById(R.id.fplanView);
_fplanView.init("https://demo.expofp.com", settings);
The second way is to run in the background using GlobalLocationProvider.
GlobalLocationProvider
Very often needed to run a location provider in the background, ExpoFP SDK has a GlobalLocationProvider for this. The GlobalLocationProvider runs once at program startup and work in the background.
LocationProvider locationProvider = ...;
GlobalLocationProvider.init(locationProvider);
GlobalLocationProvider.start();
When using the GlobalLocationProvider in the FplanView settings, you need to call the ‘withGlobalLocationProvider’ function:
Settings settings = new Settings()
.withGlobalLocationProvider();
_fplanView = findViewById(R.id.fplanView);
_fplanView.init("https://demo.expofp.com", settings);
When the program terminates, the GlobalLocationProvider must also be stopped:
GlobalLocationProvider.stop();
CrowdConnected location provider
Setup
Add Maven repository reference to settings.gradle file(in root of your project):
repositories {
maven { url "https://maven2.crowdconnected.net/" }
...
}
Add dependency to build.gradle file(in module):
dependencies {
implementation 'com.expofp:crowdconnected:4.8.1'
...
}
Add permissions in “AndroidManifest.xml” file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
com.expofp.crowdconnected.Settings
Constructor parameters:
appKey(String) - Your Crowd Connected App Key
token(String) - Your Crowd Connected Token
secret(String) - Your Crowd Connected Secret
mode(Mode) - IPS_ONLY | GPS_ONLY | IPS_AND_GPS
aliases(Map<String, String>) - Aliases
Functions:
enableBackgroundMode() - Runs the provider in the background
setAlias(String key, String value) - Sets an alias
setServiceNotificationInfo(String notificationText, int serviceIcon) - Sets the notification text and icon for the background service
LocationProvider initialization
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", MODE);
LocationProvider locationProvider = new com.expofp.crowdconnected.CrowdConnectedProvider(getApplication(), lpSettings);
Background mode
[!IMPORTANT] To run the location provider in the background, you must specify NOTIFICATION_TEXT and SERVICE_ICON (to do this, you need to call Settings.setServiceNotificationInfo(“NOTIFICATION_TEXT”, SERVICE_ICON)).
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", MODE);
lpSettings.setServiceNotificationInfo("NOTIFICATION_TEXT", SERVICE_ICON);
LocationProvider locationProvider = new com.expofp.crowdconnected.CrowdConnectedProvider(getApplication(), lpSettings);
GlobalLocationProvider.init(locationProvider);
GlobalLocationProvider.start();
Recommended use
When using CrowdConnectedProvider, it is recommended to run it in the background (when the program starts) using the GlobalLocationProvider.
[!IMPORTANT] To run the location provider in the background, you must specify NOTIFICATION_TEXT and SERVICE_ICON (to do this, you need to call Settings.setServiceNotificationInfo(“NOTIFICATION_TEXT”, SERVICE_ICON)).
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", MODE);
lpSettings.setServiceNotificationInfo("NOTIFICATION_TEXT", SERVICE_ICON);
LocationProvider locationProvider = new com.expofp.crowdconnected.CrowdConnectedProvider(getApplication(), lpSettings);
GlobalLocationProvider.init(locationProvider);
GlobalLocationProvider.start();
On initial startup, the CrowdConnectedProvider checks for permissions, if the permissions are delegated by the user then the CrowdConnectedProvider starts running, if there are no permissions, the CrowdConnectedProvider waits for any plan to open and requests the necessary permissions after the plan is opened. When opening a plan, you must specify “withGlobalLocationProvider” in the settings:
Settings settings = new Settings()
.withGlobalLocationProvider();
_fplanView = findViewById(R.id.fplanView);
_fplanView.init("https://demo.expofp.com", settings);
When the program terminates, the GlobalLocationProvider must also be stopped:
GlobalLocationProvider.stop();
Aliases
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", MODE);
lpSettings.setAlias("KEY_1", "VALUE_1");
lpSettings.setAlias("KEY_2", "VALUE_2");
LocationProvider locationProvider = new com.expofp.crowdconnected.CrowdConnectedProvider(getApplication(), lpSettings);
Notification settings
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", MODE);
lpSettings.setServiceNotificationInfo("NOTIFICATION_TEXT", SERVICE_ICON);
LocationProvider locationProvider = new com.expofp.crowdconnected.CrowdConnectedProvider(getApplication(), lpSettings);
IndoorAtlas location provider
Setup
Add Maven repository reference to settings.gradle file(in root of your project):
repositories {
maven { url "https://dl.cloudsmith.io/public/indooratlas/mvn-public/maven/" }
...
}
Add dependency to build.gradle file(in module):
dependencies {
implementation 'com.expofp:indooratlas:4.8.1'
implementation "com.indooratlas.android:indooratlas-android-sdk:3.5.5@aar"
...
}
Add permissions in “AndroidManifest.xml” file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
LocationProvider initialization:
LocationProvider locationProvider = new com.expofp.indooratlas.IndoorAtlasProvider(getApplication(), "API_KEY", "API_SECRET_KEY");