---
name: "updateGeofence"
mode: "kit"
deprecated: true
versionRequirements:
  - { name: "MapKit", version: "3.0.1" }
platform:
  - "iOS"
  - "Android"
async: true
---

## updateGeofence

> [DEPRECATED] **Deprecated**: register

> [VERSION] MapKit >= 3.0.1

> [PLATFORM] iOS, Android

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

### Description

Update geofences. Permission: [scope.location]

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `registerGeoFence` | `GeofenceInfo[]` | Yes | - | `3.0.1` | Registered geofences |
| `unregisterGeoFence` | `GeofenceInfo[]` | Yes | - | `3.0.1` | Unregistered geofences |
| `complete` | `() => void` | No | - | - | Callback invoked when the API call completes (runs on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on failed API call |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `success` | `boolean` | `3.0.5` | Update succeeded |

#### 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 message |


### Referenced Types

##### `interface` GeofenceInfo

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `geoTitle` | `string` | `3.9.1` | Geofence name |
| `longitude` | `number` | `3.9.1` | Longitude |
| `latitude` | `number` | `3.9.1` | Latitude |
| `radius` | `number` | `3.9.1` | Radius |
| `geofenceId` | `string` | `3.9.1` | id |
| `type` | `number` | `3.9.1` | Radius 0: Enter geofence 1: Leave geofence |


### Examples

```tsx
ty.map.updateGeofence({
  registerGeoFence: [
    {
      geoTitle: "xx",
      longitude: 116.39747,
      latitude: 39.908823,
      radius: 200,
      geofenceId: "xx",
      type: 0,
    },
  ],
  unregisterGeoFence: [],
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
