Class BLETimer


  • public class BLETimer
    extends java.lang.Object
    Steady one second timer for controlling BLE operations. Having a reliable timer for starting and stopping scans is fundamental for reliable detection and tracking. Methods that have been tested and failed included : 1. Handler.postDelayed loop backed by MainLooper - Actual delay time can drift to 10+ minutes for a 4 second request. 2. Handler.postDelayed loop backed by dedicated looper backed by dedicated HandlerThread - Slightly better than option (1) but actual delay time can still drift to several minutes for a 4 second request. 3. Timer scheduled task loop - Timer can drift

    Test impact of power management by ...

    1. Run app on device 2. Keep one device connected via USB only 3. Put app in background mode and lock device 4. Go to terminal 5. cd ~/Library/Android/sdk/platform-tools

    Test DOZE mode 1. ./adb shell dumpsys battery unplug 2. Expect "powerSource=battery" on log 3. ./adb shell dumpsys deviceidle force-idle 4. Expect "idle=true" on log

    Exit DOZE mode 1. ./adb shell dumpsys deviceidle unforce 2. ./adb shell dumpsys battery reset 3. Expect "idle=false" and "powerSource=usb/ac" on log

    Test APP STANDBY mode 1. ./adb shell dumpsys battery unplug 2. Expect "powerSource=battery" 3. ./adb shell am set-inactive io.heraldprox.herald true

    Exit APP STANDBY mode 1. ./adb shell am set-inactive io.heraldprox.herald false 2. ./adb shell am get-inactive io.heraldprox.herald 3. Expect "idle=false" on terminal 4. ./adb shell dumpsys battery reset 5. Expect "powerSource=usb/ac" on log

    • Constructor Summary

      Constructors 
      Constructor Description
      BLETimer​(android.content.Context context)  
    • Constructor Detail

      • BLETimer

        public BLETimer​(@NonNull
                        android.content.Context context)
    • Method Detail

      • finalize

        protected void finalize()
        Overrides:
        finalize in class java.lang.Object