Problems with multi beacons


I am a newer for estimote beacons and recently I tried to use the Android-Proximity-SDK to detect 3 beacons but now I face some problems.

  1. When the smartphone moves close or far away the beacons I will get wrong information sometimes. For example I am moving from pink beacon to yellow one and I get ‘Previous you were near the pink beacon’ and then I get ‘Previous you were near the purple beacon’ which is totally wrong

    I don’t know it’s due to the smartphones receiving capability or there are some bug in the code. I changed the working range in the code to make sure there is no overlapping of different range but I still get confusion information. One thing is the yellow beacon seems has stronger signal strength even I out of the range I can detect it. Also I saw some suggestions from forum and decreased the advertising interval from 1000ms to 200ms but the result didn’t change.

  2. Could you please tell me the difference between using estimote API and Eddystone ?

  3. Now the application is running in foreground how can I change it to background?

This is the main part of my code. Can someone answer my questions? Thank you in advance.

class MainActivity : AppCompatActivity() {

/** Fields in this class */

// Related to proximity methods
private lateinit var proximityObserver: ProximityObserver
private var proximityObservationHandler: ProximityObserver.Handler? = null
//private lateinit var proximityObservationHandler: ProximityObserver.Handler

// Could credentials found from
private val cloudCredentials = EstimoteCloudCredentials("laboratorium-dibris-gmail--kfg", "90e1b9d8344624e9c2cd42b9f5fd6392")

// Lambda functions for displaying errors when checking requirements
private val displayToastAboutMissingRequirements: (List<Requirement>) -> Unit = { Toast.makeText(this, "Unable to start proximity observation. Requirements not fulfilled: ${it.size}", Toast.LENGTH_SHORT).show() }
private val displayToastAboutError: (Throwable) -> Unit = { Toast.makeText(this, "Error while trying to start proximity observation: ${it.message}", Toast.LENGTH_SHORT).show() }

/** Methods in this class */

// onCreate method runs first (when an application is launched)
override fun onCreate(savedInstanceState: Bundle?) {

    // Requirements check
            onRequirementsFulfilled = { startProximityObservation() },
            onRequirementsMissing = displayToastAboutMissingRequirements,
            onError = displayToastAboutError

// The method where you implement the logic for your application
private fun startProximityObservation() {

    proximityObserver = ProximityObserverBuilder(applicationContext,cloudCredentials)
            .withTelemetryReportingDisabled() //Added this to reduce the bluetooth call back traffic which was giving an error " Closed Bluetooth Low Energy scan failed with error code: 2"
            .withAnalyticsReportingDisabled() //Similarly this
            .withEstimoteSecureMonitoringDisabled() //Similarly this

   val pinkBeacon = ProximityZoneBuilder()
                Log.d("Debug.. ", "Currently near the pink beacon")
                textView.text = "Currently near pink beacon"
                Log.d("Debug.. ", "Previously you were near the pink beacon")
                textView.text = "Previously you were near pink beacon"

     val purpleBeacon = ProximityZoneBuilder()
                Log.d("Debug.. ", "Currently near the purple beacon")
                textView.text = "Currently near purple beacon"
                Log.d("Debug.. ", "Previously you were near the purple beacon")
                textView.text = "Previously you were near purple beacon"

    val yellowBeacon = ProximityZoneBuilder()
                Log.d("Debug.. ", "Currently near the yellow beacon")
                textView.text = "Currently near yellow beacon"
                Log.d("Debug.. ", "Previously you were near the yellow beacon")
                textView.text = "Previously you were near yellow beacon"

    proximityObservationHandler = proximityObserver.startObserving(pinkBeacon, purpleBeacon, yellowBeacon)

// onDestroy method runs last (when an application is closed)
// IMPORTANT (This applies for mobile app):
// If you don't stop the scan here, the foreground service will remain active EVEN if the user kills your APP.
// You can use it to retain scanning when app is killed, but you will need to handle actions properly.
override fun onDestroy() {


split this topic #2

A post was merged into an existing topic: Define multi beacons in latest version of Android-Proximity-SDK

closed #3