Android Alt Beacon Library Method Question.

Asked 2 years ago, Updated 2 years ago, 24 views

https://altbeacon.github.io/android-beacon-library/configure.html

We are using the alt beacon library for beacon integration. I think the existing default delay is about 1 second, but I want to control the delay below I changed the functions one way or another, but the delay didn't change.

And I'm not sure exactly what the functions below are doing. Can you tell me the difference between background and foreground?

I'd appreciate it if you could answer ㅜ<

beaconManager.setBackgroundBetweenScanPeriod (long variable);
beaconManager.setBackgroundScanPeriod;
beaconManager.setForegroundBetweenScanPeriod;
beaconManager.setForegroundScanPeriod (long variable);

 //Update
beaconManager.updateScanPeriods();

android

2022-09-21 18:58

1 Answers

Looking at the document, the default values are set as follows.

public static final long DEFAULT_BACKGROUND_BETWEEN_SCAN_PERIOD  300000L
public static final long DEFAULT_BACKGROUND_SCAN_PERIOD  10000L
public static final long DEFAULT_EXIT_PERIOD 10000L
public static final long DEFAULT_FOREGROUND_BETWEEN_SCAN_PERIOD  0L
public static final long DEFAULT_FOREGROUND_SCAN_PERIOD  1100L

Based on your previous comment that there is a delay of about 1 second, it seems to be due to 1100L (1.1 seconds) of DEFAULT_FOREGROUND_SCAN_PERIOD. Try changing the value using the setForegroundScanPeriod function. Because the unit is millisecond, you must set it to 5000L when you change it to 5 seconds.

The background and foreground are related to the status of the activity. Please refer to the article below for more information.

The functions you uploaded are APIs that can be set according to the activity status (background/foreground). For example, assuming that a sensor with increased battery consumption is used periodically, such as Bluetooth/GPS, API is provided to set the update cycle quickly in foreground and slow in background to reduce battery consumption.I think we can approach it like this.


2022-09-21 18:58

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.