Introduction
Welcome to the Proximi.io Android SDK reference. Use our library to hook into the Proximi.io platform.
You can find the iOS reference here.
Code samples can be found on the right side of the page, and a sample Android project can be found here.
You can find our Proximi.io Android Map SDK here. (Note: For the deprecated map library, see here.)
When testing, please use a real device in order to guarantee proper behaviour with access to real sensor data.
IMPORTANT: Repository change (Please read if you encountered issues downloading Proximi.io or IndoorAtlas libraries)
Due to Bintray service scheduled shutdown, we are hosting from to our own privately hosted repository. Although the existing packages should be accessible until February 2021, we have noticed several instances where packages became inaccessible for days.
We have moved existing (old) version of our own library as well our dependency library "Indoor Atlas" to our privately hosted repository. Please replace the repository in the gradle file according to the provided example.
Important: From version 5.1.0 forward, we have adjusted the naming of our library package from io.proximi.proximiiolibrary:proximiiolibrary
to io.proximi.library:core
. Please adjust your gradle dependencies accordingly.
repositories {
...
// OLD REPOSITORIES - Please remove these
// maven {
// url "http://proximi-io.bintray.com/proximiio-android"
// }
// maven {
// url "http://indooratlas-ltd.bintray.com/mvn-public"
// }
// NEW REPOSITORY - Proximi.io repository, use this one:
maven { url "https://maven.proximi.io/repository/android-releases/" }
maven { url 'https://jitpack.io' }
}
API Changelog
5.1.12
- Add support for fallback api
- Minor adjustments
5.1.11
- tweak support for permissions for Bluetooth in Android S+
5.1.10
- updated gradle to stable
- updates to support Android S
5.1.8
- Added 'transtional' input support.
- Note: version numbers skipped to bring in line with mapbox SDK.
5.1.3
- Attempted fixes for bugs suspected to be caused by calling api methods from non-main thread.
5.1.2
- Fixed PDR doubling steps and minor PDR tweaks.
- Fixed minor crashes.
5.1.0
- Increased frequency of GPS location updates when using
GPS_HIGH_POWER
native location setting. - IMPORTANT: Moved packages to new repository due to Bintray service closing down.
- IMPORTANT: With the move, the library repository was renamed from
io.proximi.proximiiolibrary:proximiiolibrary
toio.proximi.library:core
. You need to only update the package import in your gradle file.
5.9.0
- Added metadata for Places, Floors, Departments Inputs and Privacy zones.
5.0.8
- Improvements to step detection.
- Improvements to floor selection based on beacons.
- Fix to an (uncommon) crash when only beacon in range is position-fix beacon.
- Build targeting current Android version (30).
- Added check for background location permission, see background location section bellow.
5.0.4
- Improved PDR and BLE fusion behaviour.
5.0.0
- Unifying versioning between libs to correspoint to API version.
- Snapping functionality now supports routable areas.
2.8.10
- Added support for location snapping to wayfinding paths.
2.8.3
- Moved data write operations from
ProximiioAPI
toProximiioAdmin
.
2.8
- Upgraded the SDK to target Android API level 28 (Android 9).
- Added support for privacy zones.
ProximiioAPI.setAuth
now takes aretryNetworkErrors
parameter.ProximiioNetworkObject.getChildren
andProximiioNetworkObject.getAllChildren
can now be filtered for specific types.- Renamed
getMAC
togetAddress
underProximiioBLEDevice
andProximiioBLEDeviceFilter
.
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 {
...
maven {
url "https://maven.proximi.io/repository/android-releases/"
}
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
}
dependencies {
...
implementation 'io.proximi.library:core:5.1.12'
}
Add the following to your module's build.gradle
file.
(Just replace the version number in the build.gradle
with the latest version.)
You also need to make the IndoorAtlas and Google dependencies available in a similar fashion.
Getting Started
Foreground
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import io.proximi.proximiiolibrary.ProximiioAPI;
import io.proximi.proximiiolibrary.ProximiioListener;
import io.proximi.proximiiolibrary.ProximiioOptions;
public class MainActivity extends AppCompatActivity {
private ProximiioAPI proximiioAPI;
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);
}
@Override
protected void onStart() {
super.onStart();
ProximiioOptions options = new ProximiioOptions()
.setNotificationMode(ProximiioOptions.NotificationMode.ENABLED);
proximiioAPI = new ProximiioAPI(TAG, this, options);
proximiioAPI.setListener(new ProximiioListener() {
@Override
public void position(double lat, double lon, double accuracy) {
// Do something with the positioning system.
// See ProximiioListener in the docs for all available methods/callbacks.
}
});
// This will begin SDK operation
proximiioAPI.setAuth(AUTH, true);
proximiioAPI.setActivity(this);
proximiioAPI.onStart();
}
@Override
protected void onStop() {
super.onStop();
proximiioAPI.onStop();
proximiioAPI.destroy();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
proximiioAPI.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
proximiioAPI.onActivityResult(requestCode, resultCode, data);
}
}
Your application is on the foreground when you have an Activity
open.
Here's an example of using Proximi.io on the foreground.
First, in the onStart
method, we create options to use with the SDK. Please see here for more information about options.
A new instance of ProximiioAPI
is created: this is your main access point to Proximi.io.
Next, we add a listener to the API, to get callbacks on events we need. In this example we've implemented the position
method. All methods of ProximiioListener
can be found here.
After setting a listener, we set the auth-key to Proximi.io. This begins the operation of Proximi.io. For more information, check setAuth
.
Next, we call the onStart
method, and the onStop
method in the Activity's onStop
method.
These make sure that Proximi.io stays up to date on the Activity state, even if you initialize and destroy ProximiioAPI
outside the recommended Activity onStart
and onStop
methods.
Finally, in the onStop
method, we destroy the API object. This also destroys our listener. To use Proximi.io on the background, please see the Background section.
Permissions
Proximi.io requires permission to use the device location, as well as Bluetooth if your application scans for Bluetooth Low Energy devices.
To let Proximi.io automatically ask these permissions when it needs them, you can set an Activity
for Proximi.io to use with setActivity
, and supply Proximi.io with the results by overriding onRequestPermissionsResult
and onActivityResult
in your Activity
.
If you don't want Proximi.io interacting with the user, you can exclude setActivity
, onRequestPermissionsResult
, and onActivityResult
.
Multiple Activities
As a rule of thumb, you should always have one ProximiioAPI
instance per (top-level) class, whether it's an Activity
, Fragment
, or something else.
Avoid having a single instance for your whole application (if you have multiple components), as distributing the data from Proximi.io to your intended destinations can easily become a lot of work.
Background
BroadcastReceiver
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import io.proximi.proximiiolibrary.ProximiioAPI;
public class BackgroundReceiver extends BroadcastReceiver {
private static final String TAG = "BackgroundReceiver";
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case ProximiioAPI.ACTION_POSITION:
double lat = intent.getDoubleExtra(ProximiioAPI.EXTRA_LAT, 0);
double lon = intent.getDoubleExtra(ProximiioAPI.EXTRA_LON, 0);
Log.d(TAG, "Position! (" + lat + ", " + lon + ")");
break;
}
}
}
AndroidManifest.xml
<application>
...
<receiver android:name=".BackgroundReceiver" android:exported="false">
<intent-filter>
<action android:name="io.proximi.proximiiolibrary.action.POSITION"/>
</intent-filter>
</receiver>
</application>
If you need to react to Proximi.io events in real time on the background, you can use a BroadcastReceiver
.
Start by creating a new class, which extends BroadcastReceiver
. Then override the onReceive
method.
Check the intent's action to find out what event you're handling. After that, you can access any extras that are available.
For all of this to work, we need to register the BroadcastReceiver
in your module's AndroidManifest.xml
. Add your new receiver
under your application
,
with android:exported
set to false. Add an intent-filter
with the actions you wish to receive.
All actions and extras available are listed here.
Background location permission
Since Android API version 29 (Android Q) Android introduced a separate permission ACCESS_BACKGROUND_LOCATION
to receive background location updates.
This cannot be done via the usual system dialog request, so you should implement this in your own app's implementation (for specifics, please see the official Android documentation). Please do not forget to add this permission to your own app's manifest if required as well (the SDK ommits this permission as not to force apps which do not use it to declare it).
Note: This permission is not needed if you are using the SDK with the notification option set to ENABLED
or REQUIRED
, as the Proximi.io location service is running as foreground service.
What Next?
- Take a look at
ProximiioListener
andBroadcastReceiver
for all available callbacks. If you require more data from Proximi.io, most likely it can be found there. - For changing the behaviour of Proximi.io, take a look at the
ProximiioAPI
class below. - For integration with maps, take a look at our Map SDK.
- Feel free to email support@proximi.io for support, questions, and feedback.
ProximiioAPI
ProximiioOptions options = new ProximiioOptions()
.setNotificationMode(ProximiioOptions.NotificationMode.ENABLED);
proximiioAPI = new ProximiioAPI("MyProximi.io", context, options);
public ProximiioAPI(@NonNull String id, @NonNull Context context, @Nullable ProximiioOptions options)
ProximiioAPI
is your entry point to SDK capabilities.
Create a new instance with an ID, Context
, and ProximiioOptions
to get started.
The ID is used to keep track of this particular instance over the application life cycle. Please use different IDs for different API objects.
Previously supplied options will be used for all unspecified options. If an option has not been supplied previously, the default option will be used. For more information about options, see here.
setActivity
proximiioAPI.setActivity(MainActivity.this);
public void setActivity(@Nullable Activity activity)
Enable asking the user for permissions, location, and Bluetooth if needed.
Please hook your Activity to call ProximiioAPI.onRequestPermissionsResult
and ProximiioAPI.onActivityResult
to inform Proximi.io about the results.
setListener
public void setListener(@Nullable ProximiioListener listener)
Set a listener for Proximi.io events. Call with a null
parameter to remove.
setAuth
proximiioAPI.setAuth("exampleauthkey", true);
public void setAuth(@NonNull String token, boolean retryNetworkErrors)
Set the authorization key for Proximi.io. Use this or ProximiioAPI.setLogin
to contact Proximi.io servers and begin operation.
If this is successful, ProximiioAPI.trySavedLogin
can be used in the future instead if desired.
Setting the parameter retryNetworkErrors
to true
makes the SDK retry the authentication if it encounters a network error, until authentication is successful or an error of another type occurs.
Please note that ProximiioListener.loginFailed
with the error LoginError.NETWORK_ERROR
will be fired as usual.
Calling this method is only necessary once in your application's life cycle, but subsequent calls make no harm.
You can find your authorization keys in your web portal (or use the shared portal) under "Manage Applications".
Click the token of the application you want to use and copy paste it to your setAuth
method. Please note that application keys are read-only.
setLogin
proximiioAPI.setLogin("example@dev.com", "password", true);
public void setLogin(@NonNull String email, @NonNull String password, boolean retryNetworkErrors)
Login. This or ProximiioAPI.setAuth
is needed to contact Proximi.io servers and begin operation.
Sets the login information required for ProximiioAPI.trySavedLogin
if successful.
Setting the parameter retryNetworkErrors
to true
makes the SDK retry the authentication if it encounters a network error, until authentication is successful or an error of another type occurs.
Please note that ProximiioListener.loginFailed
with the error LoginError.NETWORK_ERROR
will be fired as usual.
This is only necessary to call once in your application's life cycle, but subsequent calls make no harm.
trySavedLogin
proximiioAPI.trySavedLogin();
public boolean trySavedLogin()
If this client has logged in successfully in the past, try those same credentials.
Note that ProximiioListener.loginFailed
can still be called, as this doesn't guarantee a successful login.
Returns true
if previous credentials were found and login was attempted.
register
proximiioAPI.register("new.account@example.com", "password", "Test", "Person", "Testing Company", "Canada", "Freelance developer");
public void register(@NonNull String email, @NonNull String password, @NonNull String firstName, @NonNull String lastName, @NonNull String company, @NonNull String country, @NonNull String background)
Registers a new account to Proximi.io. Fires either ProximiioListener.registered
or ProximiioListener.registrationFailed
.
Please note that typically you want to create your account through our website, and use the SDK with an existing account.
onStart
@Override
protected void onStart() {
super.onStart();
proximiioAPI.onStart();
}
public void onStart()
Call this in your Activity's onStart
method.
onStop
@Override
protected void onStop() {
super.onStop();
proximiioAPI.onStop();
}
public void onStop()
Call this in your Activity's onStop
method, or when you create a background-only API object.
destroy
proximiioAPI.destroy();
public void destroy()
Call this when you're done with this API object. Called typically in your Activity's onDestroy
.
destroyService
proximiioAPI.destroyService(false);
public void destroyService(boolean eraseData)
Call this when you want to stop Proximi.io from running.
This will also call ProximiioAPI.destroy
on this object.
Set eraseData
to true
if you want to delete all data that Proximi.io has saved, including auth keys and offline data.
With false
, Proximi.io will only stop all operations until a new instance of ProximiioAPI
is created.
setApplication
proximiioAPI.setApplication("APP_ID");
public void setApplication(@Nullable String applicationID)
Set the application you would like to use.
If null
is specified or this method hasn't been called, the application linked to the auth key will be used.
If that is not available, the first application available will be used.
getVisitorID
String visitorID = proximiioAPI.getVisitorID();
public String getVisitorID()
Get the visitor ID of the client in the Proximi.io system.
setForceBluetooth
public void setForceBluetooth(boolean forced)
Set this to true
to force Bluetooth scanning on regardless of power saving status.
Once set to false
, normal power saving modes will continue shortly.
customInputPosition
public void customInputPosition(String customInputID, double lat, double lon, double accuracy)
Provide a position update for Proximi.io with a previously added custom input.
onRequestPermissionsResult
public class MainActivity extends AppCompatActivity {
...
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
proximiioAPI.onRequestPermissionsResult(requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
Override onRequestPermissionsResult
in your Activity and send the results here if you have set an Activity with ProximiioAPI.setActivity
.
onActivityResult
public class MainActivity extends AppCompatActivity {
...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
proximiioAPI.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data)
Override onActivityResult in your Activity and send the results here if you have set an Activity with ProximiioAPI.setActivity
.
getAdmin
ProximiioListener listener = new ProximiioListener() {
@Override
public void loggedIn(boolean online, String auth) {
if (online) {
ProximiioAdmin admin = proximiioAPI.getAdmin();
if (admin != null) {
// Write data
}
}
}
};
public ProximiioAdmin getAdmin()
Get a ProximiioAdmin
instance that you can use to write data to your account.
Returns a ProximiioAdmin
instance if your auth has write permissions, otherwise null
.
snapToRouteEnabled
proximiApi.snapToRouteEnabled(enabled);
public ProximiioAdmin snapToRouteEnabled(@NonNull Boolean enabled)
Toggle location snapping to routes defined in Wayfinding feature.
When enabled, SDK snaps location to nearest defined route within the threshold.
If no route is within the threshold, raw position is returned.
Threshold can be changed using proximiApi.snapToRouteThreshold()
.
snapToRouteThreshold
proximiApi.snapToRouteThreshold(5.0);
public ProximiioAdmin snapToRouteThreshold(@NonNull Double thresholdInMeters)
Sets a threshold for snapping to routes. Default value is 5 meters. Position will be snapped only if distance between raw position and snapped is lower than this threshold.
pdrEnabled
proximiApi.pdrEnabled(true);
public void pdrEnabled(@NonNull Boolean enabled)
Enable pedestrian dead reckoning (step detection) on top of other localization methods. Important: enable this only from UI. Direction of step is calculated based on device orientation.
ProximiioAdmin
ProximiioListener listener = new ProximiioListener() {
@Override
public void loggedIn(boolean online, String auth) {
if (online) {
ProximiioAdmin admin = proximiioAPI.getAdmin();
if (admin != null) {
// Write data
}
}
}
};
ProximiioAdmin
can be used to write data to your account. Get an instance from ProximiioAPI
.
addPlace
public boolean addPlace(String name, double lat, double lon, @Nullable String address, @Nullable String indoorAtlasVenueID, @Nullable String[] tags, @Nullable JSONObject metadata)
Add a new place. Returns true
if validation was successful.
addFloor
public boolean addFloor(String name, @Nullable String indoorAtlasFloorPlanID, @Nullable String floorPlanURL, ProximiioPlace place, @Nullable Integer floorNumber, @Nullable JSONObject metadata)
Add a new floor. Returns true
if validation was successful.
addDepartment
public boolean addDepartment(String name, ProximiioFloor floor, String[] tags, @Nullable Boolean exclusiveTrilateration, @Nullable Boolean modifyPositioning, @Nullable Boolean eddystones, @Nullable Boolean iBeacons, @Nullable Boolean indoorAtlas, @Nullable Boolean nativePositioning, @Nullable JSONObject metadata)
Add a new department. Returns true
if validation was successful.
addInput
public boolean addInput(String name, @Nullable ProximiioDepartment department, ProximiioInput.InputType type, double lat, double lon, @Nullable ProximiioBeaconFilter filter, @Nullable Double height, @Nullable JSONObject metadata)
Add a new input. Returns true
if validation was successful.
addGeofence
public boolean addGeofence(String name, @Nullable ProximiioNetworkObject department, double lat, double lon, double radius, @Nullable String address, @Nullable JSONObject metadata)
public boolean addGeofence(String name, @Nullable ProximiioNetworkObject department, double[][] polygon, @Nullable String address, @Nullable JSONObject metadata)
Add a new geofence. Returns true
if validation was successful.
addPrivacyZone
public boolean addPrivacyZone(String name, @Nullable ProximiioNetworkObject department, double lat, double lon, double radius, @Nullable JSONObject metadata)
public boolean addPrivacyZone(String name, @Nullable ProximiioNetworkObject department, double[][] polygon, @Nullable JSONObject metadata)
Add a new privacy zone. Returns true
if validation was successful.
addApplication
public boolean addApplication(String name, boolean eddyStones, boolean iBeacons, boolean indoorAtlas, @Nullable String indoorAtlasApiKey, @Nullable String indoorAtlasApiKeySecret, boolean nativePositioning, ProximiioApplication.NativeAccuracy nativeAccuracy, @Nullable Boolean bluetoothTrilateration, @Nullable Boolean remoteMode, @Nullable Boolean isNetworkInterval, @Nullable Integer networkInterval, @Nullable Boolean geofencePositioning, @Nullable Integer nativeActivationTime, @Nullable ProximiioApplication.AccelerometerMode accelerometer, @Nullable Boolean inputPositionCheck, @Nullable Integer inputPositionMargin, @Nullable Boolean extraBLEInputID, @Nullable Boolean extraBLEUnregistered, @Nullable String[] unregisteredUUIDs, @Nullable String[] unregisteredNamespaces, @Nullable Boolean extraBLEInputPositionCheck, @Nullable Integer extraBLENetworkInterval)
Add a new application. Returns true
if validation was successful.
editPlace
public boolean editPlace(String name, double lat, double lon, @Nullable String address, @Nullable String indoorAtlasVenueID, @Nullable String[] tags, @Nullable JSONObject metadata, String id)
Edit an existing place. Returns true
if validation was successful.
editFloor
public boolean editFloor(String name, @Nullable String indoorAtlasFloorPlanID, @Nullable String floorPlanURL, ProximiioPlace place, @Nullable Integer floorNumber, @Nullable JSONObject metadata, String id)
Edit an existing floor. Returns true
if validation was successful.
editDepartment
public boolean editDepartment(String name, ProximiioFloor floor, String[] tags, @Nullable Boolean exclusiveTrilateration, @Nullable Boolean modifyPositioning, @Nullable Boolean eddystones, @Nullable Boolean iBeacons, @Nullable Boolean indoorAtlas, @Nullable Boolean nativePositioning, @Nullable JSONObject metadata, String id)
Edit an existing department. Returns true
if validation was successful.
editInput
public boolean editInput(String name, @Nullable ProximiioDepartment department, ProximiioInput.InputType type, double lat, double lon, @Nullable ProximiioBeaconFilter filter, @Nullable Double height, @Nullable JSONObject metadata, String id)
Edit an existing input. Returns true
if validation was successful.
editGeofence
public boolean editGeofence(String name, @Nullable ProximiioNetworkObject department, double lat, double lon, double radius, @Nullable String address, @Nullable JSONObject metadata, String id)
public boolean editGeofence(String name, @Nullable ProximiioNetworkObject department, double[][] polygon, @Nullable String address, @Nullable JSONObject metadata, String id)
Edit an existing geofence. Returns true
if validation was successful.
editPrivacyZone
public boolean editPrivacyZone(String name, @Nullable ProximiioNetworkObject department, double lat, double lon, double radius, @Nullable JSONObject metadata, String id)
public boolean editPrivacyZone(String name, @Nullable ProximiioNetworkObject department, double[][] polygon, @Nullable JSONObject metadata, String id)
Edit an existing privacy zone. Returns true
if validation was successful.
editApplication
public boolean editApplication(String name, boolean eddyStones, boolean iBeacons, boolean indoorAtlas, @Nullable String indoorAtlasApiKey, @Nullable String indoorAtlasApiKeySecret, boolean nativePositioning, ProximiioApplication.NativeAccuracy nativeAccuracy, @Nullable Boolean bluetoothTrilateration, @Nullable Boolean remoteMode, @Nullable Boolean isNetworkInterval, @Nullable Integer networkInterval, @Nullable Boolean geofencePositioning, @Nullable Integer nativeActivationTime, @Nullable ProximiioApplication.AccelerometerMode accelerometer, @Nullable Boolean inputPositionCheck, @Nullable Integer inputPositionMargin, @Nullable Boolean extraBLEInputID, @Nullable Boolean extraBLEUnregistered, @Nullable String[] unregisteredUUIDs, @Nullable String[] unregisteredNamespaces, @Nullable Boolean extraBLEInputPositionCheck, @Nullable Integer extraBLENetworkInterval, String id)
Edit an existing application. Returns true
if validation was successful.
deletePlace
public boolean deletePlace(String id)
Delete a place. Returns false if API is being destroyed.
deleteFloor
public boolean deleteFloor(String id)
Delete a floor. Returns false if API is being destroyed.
deleteDepartment
public boolean deleteDepartment(String id)
Delete a department. Returns false if API is being destroyed.
deleteInput
public boolean deleteInput(String id)
Delete an input. Returns false if API is being destroyed.
deleteGeofence
public boolean deleteGeofence(String id)
Delete a geofence. Returns false if API is being destroyed.
deletePrivacyZone
public boolean deletePrivacyZone(String id)
Delete a privacy zone. Returns false if API is being destroyed.
deleteApplication
public boolean deleteApplication(String id)
Delete an application. Returns false if API is being destroyed.
ProximiioOptions
ProximiioOptions options = new ProximiioOptions()
.setNotificationMode(ProximiioOptions.NotificationMode.ENABLED)
.setNotificationTitle("My Notification")
.setNotificationText("This is a notification.")
.setNotificationIcon(R.drawable.myIcon)
.setNotificationGroupID("myGroupID")
.setNotificationChannelName("Proximi.io Background Status")
.setNotificationChannelDescription("Displayed when Proximi.io background components are active.");
public ProximiioOptions()
ProximiioOptions
is a way to set options specific to the Proximi.io Android SDK:
- Notification mode (
Service
priority). - Notification title.
- Notification text.
- Notification icon.
- Notification group.
- Notification channel name and description.
setNotificationMode
ProximiioOptions options = new ProximiioOptions()
.setNotificationMode(ProximiioOptions.NotificationMode.ENABLED);
public ProximiioOptions setNotificationMode(NotificationMode notificationMode)
This sets the notification policy of the SDK.
It's recommended to always display a notification, to keep your application transparent to the user, as well as to guarantee a consistent experience across all platforms.
NotificationMode
public enum NotificationMode
Key | Description |
---|---|
DISABLED | Notification is disabled. |
ENABLED | Notification is enabled. |
REQUIRED | Notification is enabled when running on Android 8 and above. (Please note that previous platforms also apply some limits to background services.) |
- Default setting: ENABLED
Returns the options object.
setNotificationTitle
ProximiioOptions options = new ProximiioOptions()
.setNotificationTitle("My Notification");
public ProximiioOptions setNotificationTitle(String notificationTitle)
Allows you to set custom content to the notification displayed.
Please note that a title, text, and an icon must be supplied for custom notification content to show. When customized notification content is shown, tapping the notification will open the application instead of the settings screen for the application. See Android documentation for more info.
- Default setting: None
Returns the options object.
setNotificationText
ProximiioOptions options = new ProximiioOptions()
.setNotificationText("This is a notification.");
public ProximiioOptions setNotificationText(String notificationText)
Allows you to set custom content to the notification displayed.
Please note that a title, text, and an icon must be supplied for custom notification content to show. When customized notification content is shown, tapping the notification will open the application instead of the settings screen for the application. See Android documentation for more info.
- Default setting: None
Returns the options object.
setNotificationIcon
ProximiioOptions options = new ProximiioOptions()
.setNotificationIcon(R.drawable.myIcon);
public ProximiioOptions setNotificationIcon(@DrawableRes int notificationIcon)
Allows you to set custom content to the notification displayed.
Please note that a title, text, and an icon must be supplied for custom notification content to show. When customized notification content is shown, tapping the notification will open the application instead of the settings screen for the application. See Android documentation for more info.
- Default setting: None
Returns the options object.
setNotificationChannelName
ProximiioOptions options = new ProximiioOptions()
.setNotificationChannelName("My Channel Name");
public ProximiioOptions setNotificationChannelName(String notificationChannelName)
Android 8 introduced notification channels. The Proximi.io Android SDK will create a new notification channel for its notifications, when required. This will let you customize the notification channel name.
- Default setting: "Proximi.io Background Status"
Returns the options object.
setNotificationChannelDescription
ProximiioOptions options = new ProximiioOptions()
.setNotificationChannelDescription("My Channel Description");
public ProximiioOptions setNotificationChannelDescription(String notificationChannelDescription)
Android 8 introduced notification channels. The Proximi.io Android SDK will create a new notification channel for its notifications, when required. This will let you customize the notification channel description.
- Default setting: "Displayed when Proximi.io background components are active."
Returns the options object.
setNotificationGroupID
ProximiioOptions options = new ProximiioOptions()
.setNotificationGroupID("myGroupID");
public ProximiioOptions setNotificationGroupID(String notificationGroupID)
Android 8 introduced notification channels. If you want the Proximi.io notification channel to belong to a notification group, create a notification group and supply its ID here.
- Default setting: None
Returns the options object.
getNotificationMode
@Nullable public NotificationMode getNotificationMode()
Returns the notification mode on this object.
getNotificationTitle
@Nullable public String getNotificationTitle()
Returns the notification title on this object.
getNotificationText
@Nullable public String getNotificationText()
Returns the notification text on this object.
getNotificationIcon
@DrawableRes public int getNotificationIcon()
Returns the notification icon on this object.
getNotificationChannelName
@Nullable public String getNotificationChannelName()
Returns the notification channel name on this object.
getNotificationChannelDescription
@Nullable public String getNotificationChannelDescription()
Returns the notification channel description on this object.
getNotificationGroupID
@Nullable public String getNotificationGroupID()
Returns the notification group ID on this object.
ProximiioListener
ProximiioListener
is a set of callbacks to inform you about events and updates.
geofenceEnter
@Override
public void geofenceEnter(ProximiioGeofence geofence) {
Log.d("MainActivity", "Entered geofence: " + geofence.getName());
}
public void geofenceEnter(ProximiioGeofence geofence)
Called when this client enters a geofence.
geofenceExit
@Override
public void geofenceExit(ProximiioGeofence geofence, @Nullable Long dwellTime) {
Log.d("MainActivity", "Exited geofence: " + geofence.getName() + " (" + dwellTime + "s)");
}
public void geofenceExit(ProximiioGeofence geofence, @Nullable Long dwellTime)
Called when this client exits a geofence. Dwell time is provided in seconds.
loginFailed
@Override
public void loginFailed(LoginError loginError) {
switch (loginError) {
case LOGIN_FAILED:
Log.e("MainActivity", "Incorrect login credentials!");
break;
default:
Log.e("MainActivity", "Please try again later!");
break;
}
}
public void loginFailed(LoginError loginError)
This is called if login fails.
LoginError
public enum LoginError
Key | Description |
---|---|
LoginError.LOGIN_FAILED | Incorrect login credentials. |
LoginError.NETWORK_ERROR | Network timed out. If you have previously authenticated successfully, you can still log in with the same credentials while offline, and this error won't be fired. |
LoginError.UNKNOWN_ERROR | Unknown error. |
loggedIn
public void loggedIn(boolean online, String auth)
This is called when Proximi.io has successfully logged in.
Parameter online
is true
when online capabilities are enabled.
Parameter auth
is your auth key. This can be useful particularly when logging in with an email/password combination.
Can be called up to two times per authentication attempt (one for offline and one for online).
registrationFailed
@Override
public void registrationFailed(RegistrationError registrationError) {
switch (error) {
case INVALID_EMAIL:
Log.e("MainActivity", "Email was invalid!");
break;
case EMAIL_ALREADY_REGISTERED:
Log.e("MainActivity", "Email address was already registered!");
break;
default:
Log.e("MainActivity", "Please try again later!");
break;
}
}
public void registrationFailed(RegistrationError registrationError)
This is called if registration fails.
RegistrationError
public enum RegistrationError
Key | Description |
---|---|
RegistrationError.INVALID_EMAIL | Email was invalid/malformed. |
RegistrationError.EMAIL_ALREADY_REGISTERED | An account with this email exists. |
RegistrationError.NETWORK_ERROR | Network timed out. |
RegistrationError.UNKNOWN_ERROR | Unknown error. |
registered
public void registered()
This is called when a new account has been successfully added.
position
public void position(double lat, double lon, double accuracy)
Called when Proximi.io has a new position available. This may come from native positioning, IndoorAtlas, BLE devices, or custom inputs, depending on which features are available in the selected application, as well as what is available in the vicinity.
Latitude and longitude are both in WGS84, and accuracy is the position update's accuracy in meters.
foundDevice
public void foundDevice(ProximiioBLEDevice device, boolean registered)
Called when Proximi.io scans a Bluetooth Low Energy device.
Parameter registered
indicates whether this device is registered to be used with Proximi.io.
This will be called every time a device is scanned.
lostDevice
public void lostDevice(ProximiioBLEDevice device, boolean registered)
Called when a device is lost, either because of a timeout, or because Proximi.io is shutting down.
Parameter registered
indicates whether this device is registered to be used with Proximi.io.
changedFloor
public void changedFloor(@Nullable ProximiioFloor floor)
Called when Proximi.io detects that this client has entered a floor.
Parameter floor
is the floor entered. null
if the floor was changed to unknown or nothing.
changedDepartment
public void changedDepartment(@Nullable ProximiioDepartment department)
Called when Proximi.io detects that this client has entered a department.
Parameter department
is the department entered. null
if the department was changed to unknown or nothing.
geofenceEventMetadata
@Nullable public JSONObject geofenceEventMetadata(double lat, double lon, @Nullable Double accuracy, ProximiioGeofence geofence, @Nullable Long dwellTime, @Nullable ProximiioInput input, ProximiioGeofence.Event event, ProximiioGeofence.EventType eventType)
You can use this to add your own metadata to geofence events.
Simply return a JSONObject
you would like to be added to the event.
The parameters describe the event.
This will be called before each ProximiioListener.geofenceEnter
and ProximiioListener.geofenceExit
.
dwellTime
is available for exit-events.
privacyZoneEnter
public void privacyZoneEnter(ProximiioArea area)
Called when this client enters a privacy zone.
Please note that when a user is inside any privacy zones, all positioning related callbacks are disabled, including:
geofenceEnter
geofenceExit
geofenceEventMetadata
foundDevice
lostDevice
position
privacyZoneEnter
privacyZoneExit
changedDepartment
changedFloor
privacyZoneExit
public void privacyZoneExit(ProximiioArea area)
Called when this client exits a privacy zone.
addedPlace
public void addedPlace(ProximiioPlace place)
Called when a place is added. This is guaranteed to be called for every existing place when you add a listener.
addedFloor
public void addedFloor(ProximiioFloor floor)
Called when a floor is added. This is guaranteed to be called for every existing floor when you add a listener.
addedDepartment
public void addedDepartment(ProximiioDepartment department)
Called when a department is added. This is guaranteed to be called for every existing department when you add a listener.
addedInput
public void addedInput(ProximiioInput input)
Called when an input is added. This is guaranteed to be called for every existing input when you add a listener.
addedGeofence
public void addedGeofence(ProximiioGeofence geofence)
Called when a geofence is added. This is guaranteed to be called for every existing geofence when you add a listener.
addedPrivacyZone
public void addedPrivacyZone(ProximiioArea area)
Called when a privacy zone is added. This is guaranteed to be called for every existing privacy zone when you add a listener.
addedApplication
public void addedApplication(ProximiioApplication application)
Called when an application is added. This is guaranteed to be called for every existing application when you add a listener.
updatedPlace
public void updatedPlace(ProximiioPlace place)
Called when a place is updated.
updatedFloor
public void updatedFloor(ProximiioFloor floor)
Called when a floor is updated.
updatedDepartment
public void updatedDepartment(ProximiioDepartment department)
Called when a department is updated.
updatedInput
public void updatedInput(ProximiioInput input)
Called when an input is updated.
updatedGeofence
public void updatedGeofence(ProximiioGeofence geofence)
Called when a geofence is updated.
updatedPrivacyZone
public void updatedPrivacyZone(ProximiioArea area)
Called when a privacy zone is updated.
updatedApplication
public void updatedApplication(ProximiioApplication application)
Called when an application is updated.
removedPlace
public void removedPlace(ProximiioPlace place)
Called when a place is removed.
removedFloor
public void removedFloor(ProximiioFloor floor)
Called when a floor is removed.
removedDepartment
public void removedDepartment(ProximiioDepartment department)
Called when a department is removed.
removedInput
public void removedInput(ProximiioInput input)
Called when an input is removed.
removedGeofence
public void removedGeofence(ProximiioGeofence geofence)
Called when a geofence is removed.
removedPrivacyZone
public void removedPrivacyZone(ProximiioArea area)
Called when a privacy zone is removed.
removedApplication
public void removedApplication(ProximiioApplication application)
Called when an application is removed.
itemsLoaded
public void itemsLoaded()
Called on listener add, after all items (places, floors, departments, inputs, geofences, applications) have been loaded.
activatedApplication
public void activatedApplication(ProximiioApplication application)
Called when an application is activated.
output
public void output(JSONObject json)
public void output(String json)
Called when Proximi.io receives an output.
Parameter json
contains the output's payload.
deviceStill
public void deviceStill()
Called when the accelerometer is enabled, and the device stops moving.
deviceMoving
public void deviceMoving()
Called when the accelerometer is enabled, and the device starts moving, or the accelerometer is disabled.
BroadcastReceiver
By implementing a BroadcastReceiver
and adding it to your AndroidManifest.xml
, you can receive callbacks from Proximi.io on the background.
All actions and extras are available as static under ProximiioAPI
, and are mirrored from ProximiioListener
.
ACTION_GEOFENCE_ENTER
<action android:name="io.proximi.proximiiolibrary.action.GEOFENCE_ENTER"/>
public static final String ACTION_GEOFENCE_ENTER
Matches ProximiioListener.geofenceEnter
.
Available extras:
ACTION_GEOFENCE_EXIT
<action android:name="io.proximi.proximiiolibrary.action.GEOFENCE_EXIT"/>
public static final String ACTION_GEOFENCE_EXIT
Matches ProximiioListener.geofenceExit
.
Available extras:
ACTION_LOGIN_FAILED
<action android:name="io.proximi.proximiiolibrary.action.LOGIN_FAILED"/>
public static final String ACTION_LOGIN_FAILED
Matches ProximiioListener.loginFailed
.
Available extras:
ACTION_LOGGED_IN
<action android:name="io.proximi.proximiiolibrary.action.LOGGED_IN"/>
public static final String ACTION_LOGGED_IN
Matches ProximiioListener.loggedIn
.
Available extras:
ACTION_REGISTRATION_FAILED
<action android:name="io.proximi.proximiiolibrary.action.REGISTRATION_FAILED"/>
public static final String ACTION_REGISTRATION_FAILED
Matches ProximiioListener.registrationFailed
.
Available extras:
ACTION_REGISTERED
<action android:name="io.proximi.proximiiolibrary.action.REGISTERED"/>
public static final String ACTION_REGISTERED
Matches ProximiioListener.registered
.
Available extras:
- None
ACTION_POSITION
<action android:name="io.proximi.proximiiolibrary.action.POSITION"/>
public static final String ACTION_POSITION
Matches ProximiioListener.position
.
Available extras:
ACTION_FOUND_DEVICE
<action android:name="io.proximi.proximiiolibrary.action.FOUND_DEVICE"/>
public static final String ACTION_FOUND_DEVICE
Matches ProximiioListener.foundDevice
.
Available extras:
ACTION_LOST_DEVICE
<action android:name="io.proximi.proximiiolibrary.action.LOST_DEVICE"/>
public static final String ACTION_LOST_DEVICE
Matches ProximiioListener.lostDevice
.
Available extras:
ACTION_CHANGED_FLOOR
<action android:name="io.proximi.proximiiolibrary.action.CHANGED_FLOOR"/>
public static final String ACTION_CHANGED_FLOOR
Matches ProximiioListener.changedFloor
.
Available extras:
ACTION_CHANGED_DEPARTMENT
<action android:name="io.proximi.proximiiolibrary.action.CHANGED_DEPARTMENT"/>
public static final String ACTION_CHANGED_DEPARTMENT
Matches ProximiioListener.changedDepartment
.
Available extras:
ACTION_GEOFENCE_EVENT_METADATA
<action android:name="io.proximi.proximiiolibrary.action.GEOFENCE_EVENT_METADATA"/>
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case ProximiioAPI.ACTION_GEOFENCE_EVENT_METADATA:
Bundle bundle = getResultExtras(true);
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("meta", "data");
bundle.putString(ProximiioAPI.EXTRA_JSON, jsonObject.toString());
}
catch (JSONException e) {
e.printStackTrace();
}
break;
}
}
public static final String ACTION_GEOFENCE_EVENT_METADATA
Matches ProximiioListener.geofenceEventMetadata
.
Available extras:
EXTRA_LAT
EXTRA_LON
EXTRA_ACCURACY
EXTRA_GEOFENCE
EXTRA_DWELL_TIME
EXTRA_INPUT
EXTRA_EVENT
EXTRA_EVENT_TYPE
You can supply your metadata JSON as with ProximiioListener.geofenceEventMetadata
by supplying a valid JSON string to result extras with the key ProximiioAPI.EXTRA_JSON
.
ACTION_PRIVACY_ZONE_ENTER
<action android:name="io.proximi.proximiiolibrary.action.PRIVACY_ZONE_ENTER"/>
public static final String ACTION_PRIVACY_ZONE_ENTER
Matches ProximiioListener.privacyZoneEnter
.
Available extras:
ACTION_PRIVACY_ZONE_EXIT
<action android:name="io.proximi.proximiiolibrary.action.PRIVACY_ZONE_EXIT"/>
public static final String ACTION_PRIVACY_ZONE_EXIT
Matches ProximiioListener.privacyZoneExit
.
Available extras:
ACTION_ADDED_PLACE
<action android:name="io.proximi.proximiiolibrary.action.ADDED_PLACE"/>
public static final String ACTION_ADDED_PLACE
Matches ProximiioListener.addedPlace
.
Available extras:
ACTION_ADDED_FLOOR
<action android:name="io.proximi.proximiiolibrary.action.ADDED_FLOOR"/>
public static final String ACTION_ADDED_FLOOR
Matches ProximiioListener.addedFloor
.
Available extras:
ACTION_ADDED_DEPARTMENT
<action android:name="io.proximi.proximiiolibrary.action.ADDED_DEPARTMENT"/>
public static final String ACTION_ADDED_DEPARTMENT
Matches ProximiioListener.addedDepartment
.
Available extras:
ACTION_ADDED_INPUT
<action android:name="io.proximi.proximiiolibrary.action.ADDED_INPUT"/>
public static final String ACTION_ADDED_INPUT
Matches ProximiioListener.addedInput
.
Available extras:
ACTION_ADDED_GEOFENCE
<action android:name="io.proximi.proximiiolibrary.action.ADDED_GEOFENCE"/>
public static final String ACTION_ADDED_GEOFENCE
Matches ProximiioListener.addedGeofence
.
Available extras:
ACTION_ADDED_PRIVACY_ZONE
<action android:name="io.proximi.proximiiolibrary.action.ADDED_PRIVACY_ZONE"/>
public static final String ACTION_ADDED_PRIVACY_ZONE
Matches ProximiioListener.addedPrivacyZone
.
Available extras:
ACTION_ADDED_APPLICATION
<action android:name="io.proximi.proximiiolibrary.action.ADDED_APPLICATION"/>
public static final String ACTION_ADDED_APPLICATION
Matches ProximiioListener.addedApplication
.
Available extras:
ACTION_UPDATED_PLACE
<action android:name="io.proximi.proximiiolibrary.action.UPDATED_PLACE"/>
public static final String ACTION_UPDATED_PLACE
Matches ProximiioListener.updatedPlace
.
Available extras:
ACTION_UPDATED_FLOOR
<action android:name="io.proximi.proximiiolibrary.action.UPDATED_FLOOR"/>
public static final String ACTION_UPDATED_FLOOR
Matches ProximiioListener.updatedFloor
.
Available extras:
ACTION_UPDATED_DEPARTMENT
<action android:name="io.proximi.proximiiolibrary.action.UPDATED_DEPARTMENT"/>
public static final String ACTION_UPDATED_DEPARTMENT
Matches ProximiioListener.updatedDepartment
.
Available extras:
ACTION_UPDATED_INPUT
<action android:name="io.proximi.proximiiolibrary.action.UPDATED_INPUT"/>
public static final String ACTION_UPDATED_INPUT
Matches ProximiioListener.updatedInput
.
Available extras:
ACTION_UPDATED_GEOFENCE
<action android:name="io.proximi.proximiiolibrary.action.UPDATED_GEOFENCE"/>
public static final String ACTION_UPDATED_GEOFENCE
Matches ProximiioListener.updatedGeofence
.
Available extras:
ACTION_UPDATED_PRIVACY_ZONE
<action android:name="io.proximi.proximiiolibrary.action.UPDATED_PRIVACY_ZONE"/>
public static final String ACTION_UPDATED_PRIVACY_ZONE
Matches ProximiioListener.updatedPrivacyZone
.
Available extras:
ACTION_UPDATED_APPLICATION
<action android:name="io.proximi.proximiiolibrary.action.UPDATED_APPLICATION"/>
public static final String ACTION_UPDATED_APPLICATION
Matches ProximiioListener.updatedApplication
.
Available extras:
ACTION_REMOVED_PLACE
<action android:name="io.proximi.proximiiolibrary.action.REMOVED_PLACE"/>
public static final String ACTION_REMOVED_PLACE
Matches ProximiioListener.removedPlace
.
Available extras:
ACTION_REMOVED_FLOOR
<action android:name="io.proximi.proximiiolibrary.action.REMOVED_FLOOR"/>
public static final String ACTION_REMOVED_FLOOR
Matches ProximiioListener.removedFloor
.
Available extras:
ACTION_REMOVED_DEPARTMENT
<action android:name="io.proximi.proximiiolibrary.action.REMOVED_DEPARTMENT"/>
public static final String ACTION_REMOVED_DEPARTMENT
Matches ProximiioListener.removedDepartment
.
Available extras:
ACTION_REMOVED_INPUT
<action android:name="io.proximi.proximiiolibrary.action.REMOVED_INPUT"/>
public static final String ACTION_REMOVED_INPUT
Matches ProximiioListener.removedInput
.
Available extras:
ACTION_REMOVED_GEOFENCE
<action android:name="io.proximi.proximiiolibrary.action.REMOVED_GEOFENCE"/>
public static final String ACTION_REMOVED_GEOFENCE
Matches ProximiioListener.removedGeofence
.
Available extras:
ACTION_REMOVED_PRIVACY_ZONE
<action android:name="io.proximi.proximiiolibrary.action.REMOVED_PRIVACY_ZONE"/>
public static final String ACTION_REMOVED_PRIVACY_ZONE
Matches ProximiioListener.removedPrivacyZone
.
Available extras:
ACTION_REMOVED_APPLICATION
<action android:name="io.proximi.proximiiolibrary.action.REMOVED_APPLICATION"/>
public static final String ACTION_REMOVED_APPLICATION
Matches ProximiioListener.removedApplication
.
Available extras:
ACTION_ITEMS_LOADED
<action android:name="io.proximi.proximiiolibrary.action.ITEMS_LOADED"/>
public static final String ACTION_ITEMS_LOADED
Matches ProximiioListener.itemsLoaded
.
Available extras:
- None
ACTION_ACTIVATED_APPLICATION
<action android:name="io.proximi.proximiiolibrary.action.ACTIVATED_APPLICATION"/>
public static final String ACTION_ACTIVATED_APPLICATION
Matches ProximiioListener.activatedApplication
.
Available extras:
ACTION_OUTPUT
<action android:name="io.proximi.proximiiolibrary.action.OUTPUT"/>
public static final String ACTION_OUTPUT
Matches ProximiioListener.output
.
Available extras:
ACTION_DEVICE_STILL
<action android:name="io.proximi.proximiiolibrary.action.DEVICE_STILL"/>
public static final String ACTION_DEVICE_STILL
Matches ProximiioListener.deviceStill
.
Available extras:
- None
ACTION_DEVICE_MOVING
<action android:name="io.proximi.proximiiolibrary.action.DEVICE_MOVING"/>
public static final String ACTION_DEVICE_MOVING
Matches ProximiioListener.deviceMoving
.
Available extras:
- None
EXTRA_GEOFENCE
ProximiioGeofence geofence = intent.getParcelableExtra(ProximiioAPI.EXTRA_GEOFENCE);
public static final String EXTRA_GEOFENCE
Type: ProximiioGeofence
EXTRA_DWELL_TIME
long dwellTime = intent.getLongExtra(ProximiioAPI.EXTRA_DWELL_TIME, 0);
public static final String EXTRA_DWELL_TIME
Type: long
EXTRA_LOGIN_ERROR
ProximiioListener.LoginError error = (ProximiioListener.LoginError)intent.getSerializableExtra(ProximiioAPI.EXTRA_LOGIN_ERROR);
´public static final String EXTRA_LOGIN_ERROR´
Type: ProximiioListener.LoginError
EXTRA_ONLINE
boolean online = intent.getBooleanExtra(ProximiioAPI.EXTRA_ONLINE, false);
public static final String EXTRA_ONLINE
Type: boolean
EXTRA_AUTH
String auth = intent.getStringExtra(ProximiioAPI.EXTRA_AUTH);
public static final String EXTRA_AUTH
Type: String
EXTRA_REGISTRATION_ERROR
ProximiioListener.RegistrationError error = (ProximiioListener.RegistrationError)intent.getSerializableExtra(ProximiioAPI.EXTRA_REGISTRATION_ERROR);
public static final String EXTRA_REGISTRATION_ERROR
Type: ProximiioListener.RegistrationError
EXTRA_LAT
double lat = intent.getDoubleExtra(ProximiioAPI.EXTRA_LAT, 0);
public static final String EXTRA_LAT
Type: double
EXTRA_LON
double lon = intent.getDoubleExtra(ProximiioAPI.EXTRA_LON, 0);
public static final String EXTRA_LON
Type: double
EXTRA_ACCURACY
double accuracy = intent.getDoubleExtra(ProximiioAPI.EXTRA_ACCURACY, 0);
public static final String EXTRA_ACCURACY
Type: double
EXTRA_DEVICE
ProximiioBLEDevice device = intent.getParcelableExtra(ProximiioAPI.EXTRA_DEVICE);
public static final String EXTRA_DEVICE
Type: ProximiioBLEDevice
EXTRA_REGISTERED
boolean registered = intent.getBooleanExtra(ProximiioAPI.EXTRA_REGISTERED, false);
public static final String EXTRA_REGISTERED
Type: boolean
EXTRA_FLOOR
ProximiioFloor floor = intent.getParcelableExtra(ProximiioAPI.EXTRA_FLOOR);
public static final String EXTRA_FLOOR
Type: ProximiioFloor
EXTRA_DEPARTMENT
ProximiioDepartment department = intent.getParcelableExtra(ProximiioAPI.EXTRA_DEPARTMENT);
public static final String EXTRA_DEPARTMENT
Type: ProximiioDepartment
EXTRA_INPUT
ProximiioInput input = intent.getParcelableExtra(ProximiioAPI.EXTRA_INPUT);
public static final String EXTRA_INPUT
Type: ProximiioInput
EXTRA_EVENT
ProximiioGeofence.Event event = (ProximiioGeofence.Event)intent.getSerializableExtra(ProximiioAPI.EXTRA_EVENT);
public static final String EXTRA_EVENT
Type: ProximiioGeofence.Event
EXTRA_EVENT_TYPE
ProximiioGeofence.EventType eventType = (ProximiioGeofence.EventType)intent.getSerializableExtra(ProximiioAPI.EXTRA_EVENT_TYPE);
public static final String EXTRA_EVENT_TYPE
Type: ProximiioGeofence.EventType
EXTRA_PLACE
ProximiioPlace place = intent.getParcelableExtra(ProximiioAPI.EXTRA_PLACE);
public static final String EXTRA_PLACE
Type: ProximiioPlace
EXTRA_AREA
ProximiioArea area = intent.getParcelableExtra(ProximiioAPI.EXTRA_AREA);
public static final String EXTRA_AREA
Type: ProximiioArea
EXTRA_APPLICATION
ProximiioApplication application = intent.getParcelableExtra(ProximiioAPI.EXTRA_APPLICATION);
public static final String EXTRA_APPLICATION
Type: ProximiioApplication
EXTRA_JSON
String json = intent.getStringExtra(ProximiioAPI.EXTRA_JSON);
try {
JSONObject jsonObject = new JSONObject(json);
}
catch (JSONException e) {
e.printStackTrace();
}
public static final String EXTRA_JSON
Type: String
Please use this extra as a key when supplying metadata JSON to events.
ProximiioNetworkObject
ProximiioNetworkObject
is a base class for ProximiioPlace
, ProximiioFloor
, ProximiioDepartment
, ProximiioInput
, and ProximiioArea
.
As such, all the methods here are available in these classes.
Object parent methods
ProximiioPlace place = geofence.getPlace();
if (place != null) {
// Yay
}
To easily get a parent of an object, we've introduced convenience methods to objects to get each of their parents.
These include:
getPlace()
getFloor()
getDepartment()
Please note that these can return null
in the case where no parent is set.
If you need to get multiple parents simultaneously, or you want to understand more about object relations, please continue to the next section.
Object relations
ProximiioNetworkObject[] parents = geofence.getParents(3); // Geofence: Department, Floor, Place
ProximiioPlace place = (ProximiioPlace) parents[2];
if (place != null) {
// Yay
}
In order to get a place or a floor of a geofence for example, you must first understand the object relations and hierarchy in the SDK.
- On the top level, there's
ProximiioPlace
. - Below that, there's
ProximiioFloor
. These areProximiioPlace
's children. - Third, there's
ProximiioDepartment
. These areProximiioFloor
's children. - Last, there's both
ProximiioInput
andProximiioArea
. These areProximiioDepartment
's children. ProximiioGeofence
is a subclass ofProximiioArea
.
Now you see, that in order to get a geofence's place, you must get all the parents of that geofence, since the geofence only has a link to its department. That department has a link to a floor, and the floor links to a place.
In order to get the place of a geofence, you should use the code on the right side.
First it uses the getParents
method to get parents recursively, and then it picks the item corresponding to the place from the array.
Lastly, it checks for null
. This is possible, for example, if the geofence doesn't belong to any departments.
getJSON
@Nullable public String getJSON()
Constructs JSON from this object. Returns null
if internal parsing fails.
fromJSON
@Nullable public static ProximiioNetworkObject fromJSON(String json, ObjectType type)
Creates a new instance of the specified type based on the provided JSON. Please note, that the object being created doesn't undergo any normal integrations, meaning that it won't have references to any other objects, such as its parent or children.
Returns a new instance of the specified type if the JSON is valid, null
otherwise.
getType
public ObjectType getType()
Returns the type of this object.
ObjectType
public enum ObjectType
Key | Can be casted to |
---|---|
ObjectType.PLACES | ProximiioPlace |
ObjectType.FLOORS | ProximiioFloor |
ObjectType.DEPARTMENT | ProximiioDepartment |
ObjectType.INPUTS | ProximiioInput |
ObjectType.GEOFENCES | ProximiioGeofence (subclass of ProximiioArea) |
ObjectType.PRIVACY_ZONES | ProximiioArea |
getID
public String getID()
Returns a unique ID that represents this object.
getParentID
@Nullable public String getParentID()
Returns this object's parent's ID, if this object has or should have a parent.
getParent
@Nullable public ProximiioNetworkObject getParent()
Returns this object's parent, if available.
getChildren
public ArrayList<ProximiioNetworkObject> getChildren(ObjectType... types)
Returns a list containing all children of this object.
If you only want specific types, you can provide the types parameter. All types will be returned if omitted.
getParents
public ProximiioNetworkObject[] getParents(int levels)
Returns an array of parents, fetched recursively with getParent
. The levels
parameter indicates the expected number of parents.
If you are unsure about this, you can use ProximiioService.MAX_PARENTS
. The returned array's length will always be levels
,
but the guaranteed number of found parents is zero.
getAllChildren
public ArrayList<ProximiioNetworkObject> getAllChildren(ObjectType... types)
Returns a list of all children, as well as all children's children, and their children, etc, recursively, with getChildren
.
If you only want specific types, you can provide the types parameter. All types will be returned if omitted.
getMetadata
@Nullable public JSONObject getMetadata()
Returns the JSON content set to this object (place, floor, department, input, geofence or privacy zone (area)).
// Sample medata, we have set for a ProximiioPlace item in portal
{
"infodesk": {
"email": "infodesk@example.com",
"phone": "+123 456 789 000"
}
}
// Obtain metadata ProximiioPlace
JSONObject metadata = proximiioPlace.getMetadata();
// Access infodesk phone number by following JSON object structure
metadata.getJSONObject("infodesk").getString("phone")
getName
public String getName()
Returns this object's name.
getDescription
@Nullable public String getDescription()
Returns this object's description.
ProximiioPlace
Extends ProximiioNetworkObject
.
Represents a place.
You can get references by listening to the addedPlace
event.
Parent
- None
Children
ProximiioFloor
getAddress
@Nullable public String getAddress()
Returns the address of this place if available.
getLat
public double getLat()
Returns this place's latitude, in WGS84.
getLon
public double getLon()
Returns this place's longitude, in WGS84.
getTags
public String[] getTags()
Returns this place's tags.
getIndoorAtlasVenueID
@Nullable public String getIndoorAtlasVenueID()
Returns this place's IndoorAtlas venue, if it exists.
ProximiioFloor
Extends ProximiioNetworkObject
.
Represents a floor.
You can get references by listening to the addedFloor
event.
Parent
ProximiioPlace
Children
ProximiioDepartment
getPlace
@Nullable public ProximiioPlace getPlace()
Convenience method to get the place of this floor. Uses ProximiioNetworkObject#getParent
internally.
getFloorNumber
@Nullable public Integer getFloorNumber()
Returns this floor's number.
Returns null
if it hasn't been set.
getFloorPlanURL
@Nullable public String getFloorPlanURL()
Returns the URL for the floor plan of this floor, if available.
getIndoorAtlasFloorPlanID
@Nullable public String getIndoorAtlasFloorPlanID()
Returns this floor's IndoorAtlas floor plan ID, if available.
hasFloorPlan
public boolean hasFloorPlan()
Does this floor have a floor plan?
Returns true
if this floor has both a floor plan URL and anchors defined.
requestFloorPlanImage
public boolean requestFloorPlanImage(Context context, final ProximiioImageCallback callback)
public boolean requestFloorPlanImage(Context context, final ProximiioImageCallback callback, int maxDimension)
Request the floor plan image of this floor. The image is cached accordingly for future access.
This rotates and scales the image according to its anchors.
Returns true
if the floor plan image is being retrieved, false
if this floor doesn't have a floor plan or a floor plan retrieval is already in progress.
This calls the ProximiioImageCallback#loaded(Bitmap bitmap, float floorPlanWidth, float floorPlanHeight, double[] floorPlanPivot)
callback when successful.
Parameter maxDimension
is the width and height of the image, to which it will be downscaled if needed. This is to ensure that memory is sufficient.
You can omit this to use the default value (750), which should be safe to use on all reasonably modern phones.
If you know that your application will only run on high-end devices, you can try to experiment with this value to increase image fidelity.
requestFloorPlanImageNoTransform
public boolean requestFloorPlanImage(Context context, final ProximiioImageCallback callback)
public boolean requestFloorPlanImage(Context context, final ProximiioImageCallback callback, int maxDimension)
Request the floor plan image of this floor. The image is cached accordingly for future access.
This only returns the image bitmap, without any rotation or scaling applied.
Returns true
if the floor plan image is being retrieved, false
if this floor doesn't have a floor plan or a floor plan retrieval is already in progress.
This calls the ProximiioImageCallback#loaded(Bitmap bitmap, double[][] anchors)
callback when successful.
Parameter maxDimension
is the width and height of the image, to which it will be downscaled if needed. This is to ensure that memory is sufficient.
You can omit this to use the default value (750), which should be safe to use on all reasonably modern phones.
If you know that your application will only run on high-end devices, you can try to experiment with this value to increase image fidelity.
ProximiioImageCallback
Callback for floor plan image loading.
loaded
void loaded(Bitmap bitmap, float floorPlanWidth, float floorPlanHeight, double[] floorPlanPivot)
void loaded(Bitmap bitmap, double[][] anchors)
This is called when the image loading succeeds.
Parameter | Description |
---|---|
bitmap | The bitmap containing the floor plan. |
floorPlanWidth | The width of the floor plan in meters. |
floorPlanHeight | The height of the floor plan in meters. |
floorPlanPivot | The center point of the floor plan in latitude and longitude. |
anchors | The corners of the image, as in ProximiioFloor.getAnchors() . |
failed
void failed()
Image loading failed for some reason. You may retry here.
getAnchors
@Nullable public double[][] getAnchors()
Get the anchors (a.k.a. the corner points) of this floor. The first one is in the northwest from the center, and the rest follow clockwise.
This is an array of four coordinate pairs, defined as latitude and longitude. Returns null
if this floor doesn't specify anchors for the floor plan.
getFloorPlanPivot
@Nullable public double[] getFloorPlanPivot()
Returns the center point of the floor's floor plan. Returns null
if this floor doesn't have any anchors.
getFloorPlanSideWidth
public float getFloorPlanSideWidth()
Returns the length of the floor plan's side, that's the most aligned with the longitudinal axis, in meters. Returns zero if this floor doesn't have any anchors.
getFloorPlanSideHeight
public float getFloorPlanSideHeight()
Returns the length of the floor plan's side, that's the most aligned with the latitudinal axis, in meters. Returns zero if this floor doesn't have any anchors.
getFloorPlanWidth
public float getFloorPlanWidth()
Returns the width of the floor plan's bounding box in meters. Returns zero if this floor doesn't have any anchors.
getFloorPlanHeight
public float getFloorPlanHeight()
Returns the height of the floor plan's bounding box in meters. Returns zero if this floor doesn't have any anchors.
getFloorPlanHeading
public float getFloorPlanHeading()
Returns the heading/rotation of this floor's floor plan clockwise in degrees. Returns zero if this floor doesn't have any anchors.
getFloorPlanFlipped
public boolean getFloorPlanFlipped()
Returns whether or not this floor's floor plan image is flipped. Returns zero if this floor doesn't have any anchors.
Comparator
Collections.sort(floors, new ProximiioFloor.Comparator());
This is a class that implements the java.util.Comparator
interface, and determines order with floor numbers. This class can be used to sort lists, for example.
ProximiioDepartment
Extends ProximiioNetworkObject
.
Represents a department.
You can get references by listening to the addedDepartment
event.
Parent
ProximiioFloor
Children
ProximiioInput
ProximiioGeofence
ProximiioArea
getPlace
@Nullable public ProximiioPlace getPlace()
Convenience method to get the place of this department. Uses ProximiioNetworkObject#getParents
internally.
getFloor
@Nullable public ProximiioFloor getFloor()
Convenience method to get the floor of this department. Uses ProximiioNetworkObject#getParent
internally.
getTags
public String[] getTags()
Returns this department's tags.
isExclusiveTrilateration
public boolean isExclusiveTrilateration()
If the trilateration is happening in this department, do we constrict the trilateration to
this department only and drop all other departments' beacons from trilateration? Defaults to true
if it's not present.
isModifyPositioning
public boolean isModifyPositioning()
Returns true
if this department modifies positioning technologies used when the client is in this department.
If so, these modifications will persist until another department applies its own modifications.
Please note that these modifications do not completely override applications settings; they can't turn on technologies that aren't enabled in the application.
isIBeacons
public boolean isIBeacons()
If this department modifies positioning technologies, do we enable iBeacons?
isEddystones
public boolean isEddystones()
If this department modifies positioning technologies, do we enable Eddystones?
isIndoorAtlas
public boolean isIndoorAtlas
If this department modifies positioning technologies, do we enable IndoorAtlas?
isNativePositioning
public boolean isNativePositioning
If this department modifies positioning technologies, do we enable native positioning?
ProximiioInput
Extends ProximiioNetworkObject
.
Represents an input.
You can get references by listening to the addedInput
event.
Parent
ProximiioDepartment
Children
- None
getPlace
@Nullable public ProximiioPlace getPlace()
Convenience method to get the place of this input. Uses ProximiioNetworkObject#getParents
internally.
getFloor
@Nullable public ProximiioFloor getFloor()
Convenience method to get the floor of this input. Uses ProximiioNetworkObject#getParents
internally.
getDepartment
@Nullable public ProximiioDepartment getDepartment()
Convenience method to get the department of this input. Uses ProximiioNetworkObject#getParent
internally.
InputType
public enum InputType
Represents the input type of this input.
Key | Description |
---|---|
InputType.IBEACON | iBeacon-spec BLE device |
InputType.EDDYSTONE | Eddystone-spec BLE device |
InputType.CUSTOM | Custom input |
InputType.GENERIC_BLE | BLE device |
getInputType
public InputType getInputType()
Returns the type of this input.
getDeviceFilter
public ProximiioBLEDeviceFilter getDeviceFilter
Returns the filter that's used to match this input to a physical device.
getLat
public double getLat()
Returns this input's latitude, in WGS84.
getLon
public double getLon()
Returns this input's longitude, in WGS84.
getHeight
public double getHeight()
Returns this input's installation height in meters. Defaults to 2m if not set previously.
ProximiioArea
Extends ProximiioNetworkObject
.
Privacy zones are of this type, and you can get references to them by listening to the addedPrivacyZone
event.
Additionally, ProximiioGeofence
s are a subclass of this class.
Parent
ProximiioDepartment
Children
- None
getPlace
@Nullable public ProximiioPlace getPlace()
Convenience method to get the place of this area. Uses ProximiioNetworkObject#getParents
internally.
getFloor
@Nullable public ProximiioFloor getFloor()
Convenience method to get the floor of this area. Uses ProximiioNetworkObject#getParents
internally.
getDepartment
@Nullable public ProximiioDepartment getDepartment()
Convenience method to get the department of this area. Uses ProximiioNetworkObject#getParent
internally.
getLat
public double getLat()
Returns this area's latitude, in WGS84.
getLon
public double getLon()
Returns this area's longitude, in WGS84.
getRadius
public double getRadius()
Returns this area's radius, in meters.
getPolygon
@Nullable public double[][] getPolygon()
If this area is a polygon, return the polygon. You can use this to check if an area is polygonal. The return value is an array of latitude and longitude pairs, describing the vertices of the polygon in order.
ProximiioGeofence
Extends ProximiioArea
.
Represents a geofence.
You can get references by listening to the addedGeofence
event.
Parent
ProximiioDepartment
Children
- None
Event
public enum Event
A geofence event, either ENTER or EXIT.
Key | Description |
---|---|
Event.ENTER | Enter event |
Event.EXIT | Exit event |
EventType
public enum EventType
The position source that triggered a geofence event.
Key | Description |
---|---|
EventType.BEACON | Single BLE device |
EventType.INDOORATLAS | IndoorAtlas |
EventType.DISCONNECT | Shutting down |
EventType.NATIVE | Native positioning: WiFi, GPS, etc. |
EventType.DELETED | Geofence deleted |
EventType.TRILATERATED | Multiple BLE devices |
EventType.CUSTOM | Custom input |
isEntered
public boolean isEntered()
Returns true
if this client is inside this geofence.
getAddress
@Nullable public String getAddress()
Returns this geofence's address if available.
ProximiioApplication
Settings to be used with mobile devices. You can define multiple applications for different use cases.
NativeAccuracy
public enum NativeAccuracy
Native accuracy level.
Key | Description |
---|---|
NativeAccuracy.CELLULAR_LOW_POWER | Low power, cellular positioning. |
NativeAccuracy.WIFI_BALANCED_POWER | Balanced power, Wifi fingerprint + cellular positioning. |
NativeAccuracy.GPS_HIGH_POWER | GPS + Wifi + cellular, very high power, but accurate. |
AccelerometerMode
public enum AccelerometerMode
Accelerometer mode. Enabling the accelerometer will improve positioning stability.
Key | Description |
---|---|
AccelerometerMode.DISABLED | Accelerometer is disabled. |
AccelerometerMode.FOREGROUND | Accelerometer is enabled while the application is open. |
AccelerometerMode.ALWAYS | Accelerometer is always enabled. |
getID
public String getID()
Returns the ID of this application.
getName
public String getName()
Returns the name of this application.
isRemoteMode
public boolean isRemoteMode()
Does this application load resources based on the current location?
This should be set to enabled when there are lots of items (over a couple hundred places, inputs, geofences, etc.).
isNetworkInterval
isNetworkInterval()
Returns true
if this application sends network data in bursts to save battery.
getNetworkInterval
public int getNetworkInterval()
Returns the burst interval in milliseconds.
getNativeActivationTime
public int getNativeActivationTime()
Returns the time it takes for native positioning to take over after no position updates from other sources, in milliseconds.
isGeofencePositioning
public boolean isGeofencePositioning()
Returns true
if this application sends position updates over the network only if the client is inside a geofence.
isEddystones
public boolean isEddystones()
Returns true
if this application has Eddystone beacons enabled.
isIBeacons
public boolean isIBeacons()
Returns true
if this application has iBeacons enabled.
isBluetoothTrilateration
public boolean isBluetoothTrilateration()
Returns true
if this application calculates positions from multiple devices.
isIndoorAtlas
public boolean isIndoorAtlas()
Returns true
if this application has IndoorAtlas enabled.
isNativePositioning
public boolean isNativePositioning()
Returns true
if this application has native positioning enabled.
getNativeAccuracy
public NativeAccuracy getNativeAccuracy()
Returns the accuracy level of the native positioning.
getAccelerometer
public AccelerometerMode getAccelerometer()
Returns the accelerometer mode used.
isInputPositionCheck
public boolean isInputPositionCheck()
Returns true
if this application is comparing native position to input position. This will disable native positioning power saving.
getInputPositionMargin
public int getInputPositionMargin()
Extra margin (in meters) before triggering the position check, in meters.
isExtraBLEInputPositionCheck
public boolean isExtraBLEInputPositionCheck()
Returns true
if this application is uploading position checks.
isExtraBLEInputID
public boolean isExtraBLEInputID()
Returns true
if this application is uploading detected input IDs.
isExtraBLEUnregistered
public boolean isExtraBLEUnregistered()
Returns true
if this application is uploading unregistered devices.
getUnregisteredUUIDs
public String[] getUnregisteredUUIDs()
Unregistered device UUIDs to send. Not used on Android.
getUnregisteredNamespaces
public String[] getUnregisteredNamespaces()
Unregistered device Namespaces to send. Not used on Android.
getExtraBLENetworkInterval
public int getExtraBLENetworkInterval()
Network interval for extra BLE data uploading, in milliseconds.
getIndoorAtlasApiKey
@Nullable public String getIndoorAtlasApiKey()
Returns the IndoorAtlas API Key of this application, if it has one.
getIndoorAtlasApiKeySecret
@Nullable public String getIndoorAtlasApiKeySecret()
Returns the IndoorAtlas API Key Secret of this application, if it has one.
getJSON
@Nullable public String getJSON()
Constructs JSON from this object. Returns null
if internal parsing fails.
fromJSON
@Nullable public static ProximiioApplication fromJSON(String json)
Create a ProximiioApplication instance from JSON.
Returns a new instance of ProximiioApplication if the JSON is valid, null
otherwise.
ProximiioBLEDevice
Represents a device found by Bluetooth Low Energy scan.
This is a base class for BLE devices.
The type of the device can be found by using ProximiioBLEDevice.getType
.
If the type is IBEACON
, this class can be cast to ProximiioIBeacon
.
If the type is EDDYSTONE
, this class can be cast to ProximiioEddystone
.
Proximity
public enum Proximity
Key | Description |
---|---|
Proximity.UNKNOWN | Unknown distance. |
Proximity.IMMEDIATE | The device is very close by. |
Proximity.NEAR | The device is near. |
Proximity.FAR | The device is far. |
getAddress
public String getAddress()
Returns the address of this device.
getDistance
@Nullable public Double getDistance()
Returns the estimated distance to this device in meters.
This value is averaged over the last scan cycle.
Takes installation height into account.
Returns null
if no value is available, or privacy zones are entered.
getProximity
public Proximity getProximity()
This returns an estimate of the zone this device is in.
This values is based on the distance.
Returns Proximity.UNKNOWN
inside privacy zones.
getRSSI
public int getRSSI()
The signal strength of this device.
This is used with TxPower to determine distance.
Returns Integer.MIN_VALUE
inside privacy zones.
getTxPower
@Nullable public Integer getTxPower()
Returns the preconfigured transmit power value of the device.
This is used with RSSI to determine distance.
Returns null
if not available.
getInput
@Nullable public ProximiioInput getInput()
Returns the ProximiioInput
linked to this device, if this device matches an input and one is available, otherwise null
.
This means that the device matches the defined input.
getName
@Nullable public String getName()
Returns the name of this device.
getType
public ProximiioInput.InputType getType()
Returns the type of this device.
The following values are possible:
- IBEACON
- EDDYSTONE
- GENERIC_BLE
Comparator
Collections.sort(devices, new ProximiioBLEDevice.Comparator());
This is a class that implements the java.util.Comparator
interface, and determines order with distance. This class can be used to sort lists, for example.
ProximiioIBeacon
Represents a device found by Bluetooth Low Energy scan, that matches the iBeacon specification.
getUUID
public String getUUID()
The UUID of this device, as in iBeacon spec.
getMajor
public int getMajor()
The major value of this device.
getMinor
public int getMinor()
The minor value of this device.
ProximiioEddystone
Represents a device found by Bluetooth Low Energy scan, that matches the Eddystone specification.
getNamespace
@Nullable public String getNamespace()
The namespace of this device. Available if this device has the UID feature.
getInstanceID
@Nullable public String getInstanceID()
The instance ID of this device. Available if this device has the UID feature.
getBatteryVoltage
@Nullable public Integer getBatteryVoltage()
The battery voltage in mV. Available if this device has the TLM feature.
getTemperature
@Nullable public Float getTemperature()
The temperature measured by this device in Celsius. Available if this device has the TLM feature.
getUptime
@Nullable public Long getUptime()
The time since boot in milliseconds. Available if this device has the TLM feature.
getAdCount
@Nullable public Long getAdCount()
The advertising count of this device since boot. Available if this device has the TLM feature.
getURL
@Nullable public String getURL()
The URL of this device. Available if this device has the URL feature.
getEID
@Nullable public String getEID()
The EID of this device. Available if this device has the EID feature.
hasFeature
public boolean hasFeature(int feature)
Check what features/frames this Eddystone has.
Returns true
if one or more of the specified features are available.
These will be updated as the device transmits more packets / frame types.
You can submit the following as the feature parameter (or combine them with the | operator):
- ProximiioEddystone.FEATURE_UID
- ProximiioEddystone.FEATURE_TLM
- ProximiioEddystone.FEATURE_URL
- ProximiioEddystone.FEATURE_EID
ProximiioBLEDeviceFilter
An imaginary device that's used to match inputs to real devices. The main difference between this and ProximiioBLEDevice is that ProximiioBLEDevice is always guaranteed to be a real and unique device with an address, etc.
Constructors:
IBEACON:
public ProximiioBLEDeviceFilter(@NonNull String uuid, int major, int minor)
EDDYSTONE:
public ProximiioBLEDeviceFilter(@NonNull String namespace, @NonNull String instanceID)
GENERIC_BLE:
public ProximiioBLEDeviceFilter(@NonNull String address, int txPower)
getInputType
public ProximiioInput.InputType getInputType()
Returns the input type/spec of this filter. See ProximiioInput.InputType
getUUID
public String getUUID()
Returns the UUID of this filter. null
if this is not an iBeacon-spec filter.
getMajor
public int getMajor()
Returns the major of this filter. 0 if this is not an iBeacon-spec filter.
getMinor
public int getMinor()
Returns the minor of this filter. 0 if this is not an iBeacon-spec filter.
getNamespace
public String getNamespace()
Returns the namespace of this filter. null
if this is not an Eddystone-spec filter.
getInstanceID
public String getInstanceID()
Returns the instance ID of this filter. null
if this is not an Eddystone-spec filter.
getAddress
public String getAddress()
Returns the address of this filter. null
if this is not a generic BLE filter.
getTxPower
public int getTxPower()
Returns the calibrated transmission power of this filter. 0 if this is not a generic BLE filter.