2.2.1 version
Table of Contents
- What’s New
- Migration from 1.1.10
- Setup
- Permissions
- Usage
- Functions
- Events
- Navigation
- CrowdConnected location provider
What’s New in ExpoFP Fplan version 2.2.1
In the new version of the library, all FplanView settings have been moved to the Settings class. Some function and event names have been changed to match the JavaScript API Reference. Navigation from CrowdConnected has also been added.
Migration from 1.1.10
All FplanView settings have been moved to a separate class:
com.expofp.fplan.Settings settings = new com.expofp.fplan.Settings("https://demo.expofp.com", false, false)
//.withLocationProvider(new CrowdConnectedProvider(getApplication(), new com.expofp.crowdconnected.Settings("APP_KEY","TOKEN","SECRET")))
//.withGlobalLocationProvider()
.withEventsListener(new FplanEventsListener() {
@Override
public void onFpConfigured() { }
@Override
public void onBoothClick(String boothName) { }
@Override
public void onDirection(Route route) { }
});
fplanView.init(settings);
Some FplanView functions have been renamed:
buildRoute -> selectRoute
setCurrentPosition -> selectCurrentPosition
Some FplanEventsListener methods have been renamed:
onBoothSelected -> onBoothClick
onRouteCreated -> onDirection
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/" }
...
}
Add dependency to build.gradle file(in module):
dependencies {
implementation 'com.expofp:common:2.2.1'
implementation 'com.expofp:fplan:2.2.1'
//If you want to use navigation from CrowdConnected, add a link to the package
//implementation 'com.expofp:crowdconnected:2.2.1'
...
}
Permissions
Now there is no need to specify permissions, now each package contains a manifest file with permissions.
The com.expofp.fplan package contains a manifest file with permissions:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
The com.expofp.crowdconnected package contains a manifest file with permissions:
<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" />
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:
//noOverlay - Hides the panel with information about exhibitors
Settings settings = new Settings("https://demo.expofp.com", false)
//.withLocationProvider(new CrowdConnectedProvider(getApplication(), new com.expofp.crowdconnected.Settings("APP_KEY","TOKEN","SECRET")))
//.withGlobalLocationProvider()
.withEventsListener(new FplanEventsListener() {
@Override
public void onFpConfigured() {
}
@Override
public void onBoothClick(String s) {
}
@Override
public void onDirection(Route route) {
}
@Override
public void onMessageReceived(String message) {
}
});
_fplanView = findViewById(R.id.fplanView);
_fplanView.init(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();
Functions
Select booth:
_fplanView.selectBooth("720");
Select exhibitor:
_fplanView.selectExhibitor("ExpoPlatform");
Build route:
_fplanView.selectRoute("720", "751");
Set current position(Blue-dot):
_fplanView.selectCurrentPosition(2875, 1734);
Clear floor plan:
_fplanView.clear();
Events
Floor plan ready event:
@Override
public void onFpConfigured() {
}
Select booth event:
@Override
public void onBoothClick(String boothName) {
}
Route create event:
@Override
public void onDirection(Route route) {
}
Receive message event:
@Override
public void onMessageReceived(String message) {
}
Navigation
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.
Settings settings = new Settings("https://demo.expofp.com", false)
.withLocationProvider(SOME_LOCATION_PROVIDER);
_fplanView = findViewById(R.id.fplanView);
_fplanView.init(settings);
The second way is to run the GlobalLocationProvider when the program starts:
GlobalLocationProvider.init(SOME_LOCATION_PROVIDER);
GlobalLocationProvider.start();
When using the GlobalLocationProvider in the FplanView settings, you need to call the ‘withGlobalLocationProvider’ function:
Settings settings = new Settings("https://demo.expofp.com", false)
.withGlobalLocationProvider();
_fplanView = findViewById(R.id.fplanView);
_fplanView.init(settings);
When the program terminates, the GlobalLocationProvider must also be stopped:
GlobalLocationProvider.stop();
CrowdConnected location provider
LocationProvider initialization:
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", Mode.IPS_ONLY);
LocationProvider locationProvider = new CrowdConnectedProvider(getApplication(), lpSettings);
Aliases:
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", Mode.IPS_ONLY);
lpSettings.setAlias("KEY_1", "VALUE_1");
lpSettings.setAlias("KEY_2", "VALUE_2");
LocationProvider locationProvider = new CrowdConnectedProvider(getApplication(), lpSettings);
Notification settings:
com.expofp.crowdconnected.Settings lpSettings = new com.expofp.crowdconnected.Settings("APP_KEY", "TOKEN", "SECRET", Mode.IPS_ONLY);
lpSettings.setServiceNotificationInfo("NOTIFICATION_TEXT", SERVICE_ICON);
LocationProvider locationProvider = new CrowdConnectedProvider(getApplication(), lpSettings);