---
name: "openMapAppLocation"
mode: "kit"
versionRequirements:
  - { name: "MapKit", version: "2.1.0" }
platform:
  - "iOS"
  - "Android"
async: true
title: "ty.map.openMapAppLocation"
---

## openMapAppLocation

> [VERSION] MapKit >= 2.1.0

> [PLATFORM] iOS, Android

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

### Description

Use a third-party map to view a location

### 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 description |
| `mapType` | `string` | Yes | - | `2.1.0` | Map type; currently supported: BMK: Baidu Maps, MA: Amap (Gaode), TENCENT: Tencent Maps, Google: Google Maps |
| `complete` | `() => void` | No | - | - | Callback invoked when the API call completes (runs on both success and failure) |
| `success` | `() => void` | No | - | - | Callback invoked on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on API call failure |

#### fail callback parameters

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

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

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Examples

```tsx
ty.map.openMapAppLocation({
  latitude: 39.908823,
  longitude: 116.39747,
  name: "xx",
  address: "xx",
  mapType: "MA",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
