---
name: "openMapAppLocation"
mode: "kit"
versionRequirements:
  - { name: "MapKit", version: "2.1.0" }
  - { name: "@ray-js/ray", version: "1.2.10" }
platform:
  - "iOS"
  - "Android"
async: true
title: "map.openMapAppLocation"
---

## openMapAppLocation

> [VERSION] MapKit >= 2.1.0 | @ray-js/ray >= 1.2.10

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

View location in a third-party map

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `latitude` | `number` | Yes | - | `2.1.0` | Latitude, range -90 to 90; negative values indicate south |
| `longitude` | `number` | Yes | - | `2.1.0` | Longitude, range -180 to 180; negative values indicate west |
| `name` | `string` | Yes | - | `2.1.0` | Location name |
| `address` | `string` | Yes | - | `2.1.0` | Detailed address |
| `mapType` | `string` | Yes | - | `2.1.0` | Map type. Currently supported: BMK: Baidu Maps, MA: Amap, TENCENT: Tencent Maps, Google: Google Maps |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `() => void` | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Examples

#### Basic call

```tsx
import { map } from '@ray-js/ray'

const { openMapAppLocation } = map;

openMapAppLocation({
  latitude: 30.27,
  longitude: 120.15,
  name: 'example location',
  address: 'example address',
  mapType: 'MA',
  success: () => {
    console.log('openMapAppLocation success');
  },
  fail: (error) => {
    console.log('openMapAppLocation fail', error.errorMsg);
  },
});
```
