Monitor and Range a Beacon in the Same android App

I am trying to Range and Monitor a beacon in the same android App.
My Requirement is to Monitor my beacon and Display the Distance and Notify in case of it in Range.
In case, its out of Range, I need to notify.
But Its not working. Is there any Limitation?

What exactly is not working?