A method, comprising: receiving, by a user equipment, a list of base station sites comprising locations and geographical signal coverage of the base station sites and a list of Wi-Fi access points comprising locations and geographical signal coverage of the Wi-Fi access points; creating at least one local database storing information received in the list of base station sites and in the list of Wi-Fi access points; characterized by: detecting, by the user equipment, an absence of network coverage; searching, when the absence of network coverage is detected, the at least one local database for base station sites based on current spatial coordinates of the user equipment; searching, when the user equipment determines from the search of the at least one local database that there are base station sites that should be available and that the user equipment cannot connect to any of the base station sites, the at least one local database for possible Wi-Fi coverage based on the spatial coordinates of the user equipment; and switching, when the user equipment determines that the search of the at least one local database show that there should be Wi-Fi coverage and the user equipment cannot connect to any Wi-Fi access point, to device-to-device ad hoc communication. receiving, by a user equipment, a list of base station sites comprising locations and geographical signal coverage of the base station sites and a list of Wi-Fi access points comprising locations and geographical signal coverage of the Wi-Fi access points; creating at least one local database storing information received in the list of base station sites and in the list of Wi-Fi access points; characterized by: detecting, by the user equipment, an absence of network coverage; searching, when the absence of network coverage is detected, the at least one local database for base station sites based on current spatial coordinates of the user equipment; searching, when the user equipment determines from the search of the at least one local database that there are base station sites that should be available and that the user equipment cannot connect to any of the base station sites, the at least one local database for possible Wi-Fi coverage based on the spatial coordinates of the user equipment; and switching, when the user equipment determines that the search of the at least one local database show that there should be Wi-Fi coverage and the user equipment cannot connect to any Wi-Fi access point, to device-to-device ad hoc communication. detecting, by the user equipment, an absence of network coverage; searching, when the absence of network coverage is detected, the at least one local database for base station sites based on current spatial coordinates of the user equipment; searching, when the user equipment determines from the search of the at least one local database that there are base station sites that should be available and that the user equipment cannot connect to any of the base station sites, the at least one local database for possible Wi-Fi coverage based on the spatial coordinates of the user equipment; and switching, when the user equipment determines that the search of the at least one local database show that there should be Wi-Fi coverage and the user equipment cannot connect to any Wi-Fi access point, to device-to-device ad hoc communication.