What is difference between foregroundscanperiod and BackgroundScanPeriod?

I found beaconManager.setForegroundScanPeriod(5000,0); and beaconManager.setBackgroundScanPeriod(5000,0); . Can you elaborate difference between it ?

forgroundscanperiod is for ranging
backgroundscanperiod is for morniting

There is two parameter in both . Can you elaborate what have to pass in it ?

https://aprilbrother.github.io/aprilbeacon-android-sdk/JavaDocs/index.html
You can to see this document