JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const location = await client.devices.location.get('deviceId');
console.log(location.latitude);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
location = client.devices.location.get(
device_id="deviceId",
)
print(location.latitude)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/droidrun-cloud-go"
"github.com/stainless-sdks/droidrun-cloud-go/option"
)
func main() {
client := mobileruncloud.NewClient(
option.WithAPIKey("My API Key"),
)
location, err := client.Devices.Location.Get(
context.TODO(),
"deviceId",
mobileruncloud.DeviceLocationGetParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", location.Latitude)
}mobilerun-cloud devices:location get \
--api-key 'My API Key' \
--device-id deviceIdcurl --request GET \
--url https://api.mobilerun.ai/devices/{deviceId}/location \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/devices/{deviceId}/location",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.mobilerun.ai/devices/{deviceId}/location")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/devices/{deviceId}/location")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"latitude": 123,
"longitude": 123,
"$schema": "<string>"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}Misc
Get device location
Returns the device’s current simulated GPS location as latitude and longitude. Devices without geo support return an unsupported-feature error.
GET
/
devices
/
{deviceId}
/
location
JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const location = await client.devices.location.get('deviceId');
console.log(location.latitude);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
location = client.devices.location.get(
device_id="deviceId",
)
print(location.latitude)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/droidrun-cloud-go"
"github.com/stainless-sdks/droidrun-cloud-go/option"
)
func main() {
client := mobileruncloud.NewClient(
option.WithAPIKey("My API Key"),
)
location, err := client.Devices.Location.Get(
context.TODO(),
"deviceId",
mobileruncloud.DeviceLocationGetParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", location.Latitude)
}mobilerun-cloud devices:location get \
--api-key 'My API Key' \
--device-id deviceIdcurl --request GET \
--url https://api.mobilerun.ai/devices/{deviceId}/location \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/devices/{deviceId}/location",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.mobilerun.ai/devices/{deviceId}/location")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/devices/{deviceId}/location")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"latitude": 123,
"longitude": 123,
"$schema": "<string>"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}If the device cannot report a position yet, the call still succeeds and returns latitude and longitude
0 — treat 0,0 as “not available”, not as a real coordinate.Authorizations
Bearer token via Authorization header
Headers
Required range:
x >= 0Path Parameters
Was this page helpful?
⌘I