The efficiency of peer-to-peer data connection for mobile applications is still an issue, and an essential problem for their users. The newest 4G LTE networks, though offering high throughput, still do not allow a direct peer-to-peer communication. Moreover, the users of cellular networks are still charged for each megabyte of data transfer. Much better connection parameters and smaller latencies are ordered by Wi-Fi networks. However, setting up hotspot Wi-Fi networks still requires some effort, as it must be done manually in most cases. In this paper, we propose a solution based on a technique of automatic switching between a Wi-Fi hotspot and a cellular network. Our method allows one to minimize latency and maximize throughput. It also lowers the time and effort needed to establish a Wi-Fi connection.