Test with mock locations

Mocking the location on the device

⚠️

When mocking the location make sure that the data is as close to real as possible. HyperTrack platform will filter out weird data like sudden teleports to a different city.

⚠️

HyperTrack SDK ignores mock locations by default and creates an Outage in the user's timeline (because usually they are used for fraud). To enable testing with mock locations on non-emulator devices, you need to build your app with specific SDK config: HyperTrackAllowMockLocation should be set to true.

⚠️

When setting boolean parameters in Info.plist through the XML file, you need to use YES or NO values for boolean type, not true or false.

Android

Using emulator

Android Emulator lets you set point location as well as simulate device movement. Check Google's docs for emulator extended features to learn how to use Location simulation.

Locations simulated this way won't be detected as mocked by HyperTrack SDK even if HyperTrackAllowMockLocation is false.

Using real device

Android allows you to use mock location provider app (like Fake GPS) for mocking location data.

In this case Android marks the location events as mocked.

iOS

Using simulator

In the simulator status bar menu open Features > Location. There will be options to set different location presets: Custom Location, Apple Stores, Apple, City Bicycle Ride, City Run, Freeway Drive.

You can use any of those options to test your logic if it suits your needs.

Using real device

On iOS it is possible to create a test with simulated location in XCode. You will have to provide a GPX data for the path. Here are some GPX files for your convenience (we recommend City Run):

If you want to simulate locations in the app on your device, you can use a "backdoor" daemon that Apple created for Xcode. This daemon is called DTSimulateLocation (com.apple.dt.simulatelocation) and it's part of the iOS CoreLocation framework. It has a private API that accepts location lat/lon's and injects them into iOS. Using this API is only possible by running an app on macOS that emulates the way Xcode connects to an iOS device using a cable or Wi-Fi and reverse engineers the private protocol for DTSimulateLocation.

There are a number of apps that do this (apart from Xcode itself).

Free and open source:

Paid, but popular apps, that repackage the LocationSimulator code: