A method for establishing a wireless connection, comprising, at a first terminal device, the steps of: obtaining a first movement trajectory for the first terminal device through an acceleration sensor of the first terminal device, the first terminal device being in a screen-off state, the first movement trajectory indicating a movement trajectory of a first gesture; searching for at least a second terminal device via a Wireless Local Area Network, WLAN, wireless connection; acquiring via the WLAN wireless connection a second movement trajectory for a second terminal device, the second movement trajectory indicating a movement trajectory of a second gesture; determining that the second movement trajectory for the second terminal device is matched with the first movement trajectory; and establishing a different wireless connection between the first terminal device and the second terminal device, in response to the determination that the second movement trajectory is matched with the first movement trajectory, wherein determining that a second movement trajectory for a second terminal device received by the first terminal device from the second terminal device is matched with the first movement trajectory comprises: when a first frequency is the same as a second frequency or a difference between the first frequency and the second frequency is less than a preset threshold, determining that the second movement trajectory is matched with the first movement trajectory, the first frequency being a frequency according to which the first mobile terminal is shaken to generate the first movement trajectory, and the second frequency being a frequency according to which the second mobile terminal is shaken to generate the second movement trajectory. obtaining a first movement trajectory for the first terminal device through an acceleration sensor of the first terminal device, the first terminal device being in a screen-off state, the first movement trajectory indicating a movement trajectory of a first gesture; searching for at least a second terminal device via a Wireless Local Area Network, WLAN, wireless connection; acquiring via the WLAN wireless connection a second movement trajectory for a second terminal device, the second movement trajectory indicating a movement trajectory of a second gesture; determining that the second movement trajectory for the second terminal device is matched with the first movement trajectory; and establishing a different wireless connection between the first terminal device and the second terminal device, in response to the determination that the second movement trajectory is matched with the first movement trajectory, wherein determining that a second movement trajectory for a second terminal device received by the first terminal device from the second terminal device is matched with the first movement trajectory comprises: when a first frequency is the same as a second frequency or a difference between the first frequency and the second frequency is less than a preset threshold, determining that the second movement trajectory is matched with the first movement trajectory, the first frequency being a frequency according to which the first mobile terminal is shaken to generate the first movement trajectory, and the second frequency being a frequency according to which the second mobile terminal is shaken to generate the second movement trajectory. <EOS>