Listener for when location is turned on

Hello,
Is it possible to make a listener for when location is turned on?

As for now, if location is not enabled on startup, the user is presented with an alert with link to settings. But, if this alert is dismissed, and the user instead chooses to enable GPS by themselves (eg. by dragging downwards from the top and pressing “position” in Android), I’d like to run a function as soon as the location is enabled. Is this possible?