appium-android-driver
Version:
Android UiAutomator and Chrome support for Appium
78 lines • 3.51 kB
TypeScript
import type { Location } from '@appium/types';
import type { AndroidDriver } from '../driver';
/**
* Sets the device geolocation.
*
* @param location The geolocation object containing latitude, longitude, and altitude.
* @returns Promise that resolves to the current geolocation after setting it.
*/
export declare function setGeoLocation(this: AndroidDriver, location: Location): Promise<Location>;
/**
* Set the device geolocation.
*
* @param latitude Valid latitude value.
* @param longitude Valid longitude value.
* @param altitude Valid altitude value.
* @param satellites Number of satellites being tracked (1-12). Available for emulators.
* @param speed Valid speed value.
* https://developer.android.com/reference/android/location/Location#setSpeed(float)
* @param bearing Valid bearing value. Available for real devices.
* https://developer.android.com/reference/android/location/Location#setBearing(float)
* @param accuracy Valid accuracy value. Available for real devices.
* https://developer.android.com/reference/android/location/Location#setAccuracy(float),
* https://developer.android.com/reference/android/location/Criteria
*/
export declare function mobileSetGeolocation(this: AndroidDriver, latitude: number, longitude: number, altitude?: number, satellites?: number, speed?: number, bearing?: number, accuracy?: number): Promise<void>;
/**
* Sends an async request to refresh the GPS cache.
*
* This feature only works if the device under test has Google Play Services
* installed. In case the vanilla LocationManager is used the device API level
* must be at version 30 (Android R) or higher.
*
* @param timeoutMs The maximum number of milliseconds
* to block until GPS cache is refreshed. Providing zero or a negative
* value to it skips waiting completely.
* 20000ms by default.
* @returns Promise that resolves when the GPS cache refresh is initiated.
*/
export declare function mobileRefreshGpsCache(this: AndroidDriver, timeoutMs?: number): Promise<void>;
/**
* Gets the current device geolocation.
*
* @returns Promise that resolves to the current geolocation object.
*/
export declare function getGeoLocation(this: AndroidDriver): Promise<Location>;
/**
* Gets the current device geolocation.
*
* @returns Promise that resolves to the current geolocation object.
*/
export declare function mobileGetGeolocation(this: AndroidDriver): Promise<Location>;
/**
* Checks if location services are enabled.
*
* @returns Promise that resolves to `true` if location services are enabled, `false` otherwise.
*/
export declare function isLocationServicesEnabled(this: AndroidDriver): Promise<boolean>;
/**
* Toggles the location services state.
*
* @returns Promise that resolves when the location services state is toggled.
*/
export declare function toggleLocationServices(this: AndroidDriver): Promise<void>;
/**
* Resets the geolocation to the default state.
*
* @returns Promise that resolves when the geolocation is reset.
* @throws {Error} If called on an emulator (geolocation reset does not work on emulators).
*/
export declare function mobileResetGeolocation(this: AndroidDriver): Promise<void>;
/**
* Sets the mock location permission for a specific app.
*
* @param appId The application package identifier.
* @returns Promise that resolves when the mock location permission is set.
*/
export declare function setMockLocationApp(this: AndroidDriver, appId: string): Promise<void>;
//# sourceMappingURL=geolocation.d.ts.map