Geofencing
Overview
ZEGO Instant Messaging (ZIM) SDK provides the Geofencing feature to limit communication services to a certain region in compliance with regional regulations of data privacy and protection. For example, the following table shows that if the specified region is Europe, the accessible region of the SDK is Europe, regardless of the region of the app user.
Specified region | User region | Access region | Impact on user experience |
---|---|---|---|
Europe | Europe | Europe | No impact |
Europe | China | Europe | May be significantly affected |
- If all servers in the specified region are unavailable, the SDK reports an error.
- If an app user accesses the specified region from outside over the Internet, poor Internet connection may adversely affect the access experience.
The following table describes supported regions.
To set other regions, contact ZEGOCLOUD Technical Support.
Region | Enumeration | Value |
---|---|---|
Chinese mainland | CN | 2 |
North America | NA | 3 |
Europe, including the UK | EU | 4 |
Asia, excluding the Chinese mainland and India | AS | 5 |
India | IN | 6 |
Procedure
1. Enable geofencing
The geofencing feature is paid in some cases. To check the billing policy, contact ZEGOCLOUD business personnel. To enable this feature, contact ZEGOCLOUD Technical Support.
2. Configure geofencing
Before creating the SDK, call the setGeofencingConfig method to configure geofencing.
- Geofencing information: The geofencing type and list of supported regions.
- Geofencing type: "Include" and "Exclude" are supported.
- "Include": All regions in the region list are included in the geofence.
- "Exclude": All regions in the region list are excluded from the geofence.
Configure geofencing information before calling the createWithAppConfig method; otherwise, the call does not take effect.
// Example of setting union mode
// Set union mode
ZIMGeofencingType type = ZIMGeofencingTypeInclude;
// Set the list of areas, at least 1 and no more than the number supported by the SDK
NSMutableArray<NSNumber *> *arealist = [[NSMutableArray alloc] init];
[arealist addObject:@ZIMZIMGeofencingAreaCN];
[arealist addObject:@ZIMZIMGeofencingAreaNA];
// Call this interface before createWithAppConfig
[ZIM setGeofencingConfigWithAreaList:arealist type:type];
// Example of setting exclude mode
// Set exclude mode
ZIMGeofencingType type = ZIMGeofencingTypeExclude;
// Set the list of areas, at least 1 and no more than the number supported by the SDK
NSMutableArray<NSNumber *> *arealist = [[NSMutableArray alloc] init];
[arealist addObject:@ZIMZIMGeofencingAreaCN];
[arealist addObject:@ZIMZIMGeofencingAreaNA];
// Call this interface before createWithAppConfig
[ZIM setGeofencingConfigWithAreaList:arealist type:type];
3. Other features
You can enable other features after geofencing is configured.