UNNotification.SetLocationTrigger
---------------------------------

Sets a location trigger.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [UNNotification](component_UNNotification.md) | [7.2](newinversion72.md) | ❌ No | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "UNNotification.SetLocationTrigger"; UNNotificationRef; Latitude; Longitude; Radius; Identifier { ; Repeat } ) 

**MBS**( **"UNNotification.SetLocationTrigger";** /\* Sets a location trigger. \*/  
**$UNNotificationRef**; /\* The reference number of the notification.e.g. $Notification \*/   
**$Latitude**; /\* The latitude of the region center.e.g. 37.354444 \*/   
**$Longitude**; /\* The longitude of the region center.e.g. -121.969167 \*/   
**$Radius**; /\* The radius of the circular region in meter.e.g. 50000 \*/   
**$Identifier**; /\* The user displayable identifier for the region.e.g. "Santa Clara area" \*/   
**$Repeat**) /\* Optional; Whether to repeat this notification.  
Pass 1 to enable or 0 to disable. Default is 0.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| UNNotificationRef | The reference number of the notification. | $Notification |  |
| Latitude | The latitude of the region center. | 37.354444 |  |
| Longitude | The longitude of the region center. | -121.969167 |  |
| Radius | The radius of the circular region in meter. | 50000 |  |
| Identifier | The user displayable identifier for the region. | "Santa Clara area" |  |
| Repeat | Whether to repeat this notification.   Pass 1 to enable or 0 to disable. Default is 0. | 0 | Optional |

### Result

Returns OK or error.

### Description

Sets a location trigger.  
Can be scheduled on the device to notify when the user enters or leaves a geographic region. The identifier on region must be unique. Scheduling multiple notifications with different regions containing the same identifier will result in undefined behavior. The number of location triggers that may be scheduled by an application at any one time is limited by the system. Applications must have "when-in-use" authorization through CoreLocation.   
### Examples

Create location trigger and query back values:

 # Create a new notification   
Set Variable \[$notification ; Value:MBS ("[UNNotification.New](UNNotificationNew.md)")\]  
\# Set Title and Body   
Set Variable \[$r ; Value:MBS ("[UNNotification.SetTitle](UNNotificationSetTitle.md)"; $notification ; "Hello")\]  
Set Variable \[$r ; Value:MBS ("[UNNotification.SetBody](UNNotificationSetBody.md)"; $notification ; "Greetings from FileMaker")\]  
\# set a location trigger   
Set Variable \[$r ; Value:MBS ( "UNNotification.SetLocationTrigger"; $Notification ; 37,354444; -121,969167; 50000; "Santa Clara area")\]  
\# and query back trigger settings   
Set Variable \[$value ; Value:MBS ("[UNNotification.Region](UNNotificationRegion.md)"; $notification )\]  
Set Variable \[$value ; Value:MBS ("[UNNotification.Repeats](UNNotificationRepeats.md)"; $notification )\]  
\# and schedule   
Set Variable \[$r ; Value:MBS ("[UNNotification.Schedule](UNNotificationSchedule.md)"; $notification ; "test")\]  
### See also

- [UNNotification.New](UNNotificationNew.md)
- [UNNotification.Region](UNNotificationRegion.md)
- [UNNotification.Repeats](UNNotificationRepeats.md)
- [UNNotification.Schedule](UNNotificationSchedule.md)
- [UNNotification.SetBody](UNNotificationSetBody.md)
- [UNNotification.SetCalendarTrigger](UNNotificationSetCalendarTrigger.md)
- [UNNotification.SetTitle](UNNotificationSetTitle.md)

This function is free to use.

Created 15th April 2017 , last changed 17th April 2017

  
[UNNotification.SetLaunchImageName](UNNotificationSetLaunchImageName.md) - [UNNotification.SetNFCScript](UNNotificationSetNFCScript.md)

[HTML Version](UNNotificationSetLocationTrigger.shtml)