The Mock location unable to setup for Android and iOS devices with the Testcomplete methods
The Mock location is unable to set up for Android and iOS devices with the Testcomplete methods. I have tried with the below VB script with valid Lattitude and longitude values, the script result shows as with the given longitude and latitude values but when we check in google maps or in any other applications the location still shows the current location. SubMockGPSLocation CallMobile.SetCurrent("Nexus 7") ' Enable GPS Mobile.Device.GPS.GPSEnabled = true ' Enable the "Allow mock locations" property Mobile.Device.GPS.AllowMockLocations = true ' Obtain current location data Longt = Mobile.Device.GPS.Location.Longitude Lat = Mobile.Device.GPS.Location.Latitude Alt = Mobile.Device.GPS.Location.Altitude Acc = Mobile.Device.GPS.Location.Accuracy ' Output the location data CallLog.Message("The current device location is:") CallLog.Message("Longitude: "&Longt) CallLog.Message("Latitude: "&Lat) CallLog.Message("Altitude: "&Alt) CallLog.Message("Accuracy: "&Acc) ' Open Google Maps in the browser and pass the current coordinates as URL parameters CallBrowsers.Item(Browsers.btIExplorer).Run("http://maps.google.com/maps?q=loc:"&Lat&","&Longt) ' Change the coordinates Longt = Longt+0.005 Lat = Lat+0.005 ' Specify a mock location CallMobile.Device.GPS.SetLocation(Longt,Lat,Alt,Acc) ' Output the new location data CallLog.Message("The device mock location is:") CallLog.Message("Longitude: "&Longt) CallLog.Message("Latitude: "&Lat) CallLog.Message("Altitude: "&Alt) CallLog.Message("Accuracy: "&Acc) ' Open a new tab in the browser CallSys.Browser("iexplore").BrowserWindow(0).Keys("^t") CallDelay(1000) ' Open the new location in Google Maps CallSys.Browser("iexplore").Page("about:Tabs").ToUrl("http://maps.google.com/maps?q=loc:"&Lat&","&Longt) EndSub' Disable mock locations Mobile.Device.GPS.AllowMockLocations = false See AlsoSolved2.3KViews0likes5Comments