NearBee SDK for Android
Clone or download
Kislay Version 1.1.4
Latest commit 2fae64e Dec 5, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
NearBeeSDKSample Version 1.1.4 Dec 5, 2018
.DS_Store Init sample app Nov 2, 2018
.gitignore Init sample app Nov 2, 2018
LICENSE Initial commit Nov 2, 2018 Version 1.1.4 Dec 5, 2018

NearBee SDK for Android

You will need an API key for the NearBee SDK service to work.

Integration with your existing project in Android Studio

In the build.gradle file of the app, add the following in the dependencies section:

dependencies {
    implementation 'co.nearbee:nearbeesdk:1.1.4'
Latest version



NearBee requires the following permissions.

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Runtime permissions


NearBee requires the location permission to scan for Beacons.


1. Add your API key and Orgnization ID to the AndroidManifest.xml as follows

        android:value="MY_DEV_TOKEN" />

        android:value="123" />

2. Initialize SDK

NearBee.Builder builder = new NearBee.Builder(context)
nearBee =;
Builder options

Enables notifications from Nearby beacons in the Background. If any requirements are not met an error will be logged by the Background service. To change the behaviour (enabled to disabled and vice-versa) you need to re-initialize the SDK via the Builder as mentioned above.


Sets the time between callbacks for displaying beacon notifications in the foreground. This has no effect on the background notification behaviour.

3. Displaying available beacon notifications in Application UI

// Start scanning and get updates
nearBee.startScanning(new NearBeeListener() {
    public void onUpdate(ArrayList<NearBeeBeacon> beaconsInRange) {
        // An updated list of beacons currently in range

    public void onBeaconLost(ArrayList<NearBeeBeacon> lostBeacons) {
        // List of beacons that went out of range

    public void onBeaconFound(ArrayList<NearBeeBeacon> foundBeacons) {
        // List of beacons that appeared after last update

    public void onError(NearBeeException exception) {
        // Any error preventing Nearbee from scanning for beacons.
        // This error must be resolved and nearBee.startScanning should be called again.
// Stop scanning 
// Should ideally be done when the app goes to the background

4. Changing background notification state

// Change background notification state after initialization

5. Clear local beacon cache

// This clears the cache and forces the server to re-fetch beacon notifications

Getting notification data from the Beacon object

// Notification title
// Notification description
// Notification url
// Notification icon url

Launch the url associated with the beacon