Gateway connection

Is there an API in the semtech stack that would enable an end device to be able to determine if it is connected to a Gateway?

Our end device is configured for ADR. At some point, if the end device sends an uplink message with a request for acknowledgement and this is not acknowledged after a few retransmissions, then the end device may have to take some action (e.g. re-join). However, if the end device is not connected to a gateway, there is no point trying to re-join!