Geofencing
Feature Introduction
Geofencing refers to limiting audio, video, and signaling data transmission to a specific region to meet regional data privacy and security related regulations, that is, limiting access to audio and video services in a specific region. For example, when the specified geofencing region is Europe, regardless of the App user's region, the region actually accessed by the SDK will be Europe.
| Specified Geofencing Region | App User's Region | SDK Actually Accessed Region | User Experience After Connection |
|---|---|---|---|
| Europe | Europe | Europe | Normal |
| Europe | China | Europe | May be significantly affected |
- If all servers in the specified geofencing region are unavailable, the SDK will directly report an error.
- Since there is cross-regional public internet between the specified geofencing region and the App user's region, poor public internet network quality will cause the audio and video experience to be affected.
Currently, the SDK supports configuring the following regions:
If you need to support more regions, please contact ZEGO technical support.
| Region | Enumeration |
|---|---|
| Mainland China, excluding Hong Kong, Macao, and Taiwan | CN |
| North America | NA |
| India | IN |
| Europe | EU |
| Asia, excluding Mainland China and India | AS |
Prerequisites
Before using the geofencing feature, please ensure:
- You have created a project in the ZEGOCLOUD Console and applied for a valid AppID and AppSign. For details, please refer to Console - Project Information.
- You have integrated the ZEGO Express SDK in the project and implemented basic audio and video publishing and playing functions. For details, please refer to Quick Start - Integration and Quick Start - Implementation Flow.
Implementation Flow
1 Enable geofencing permission
Geofencing capability requires charging in some cases. Please contact ZEGO sales to confirm and enable geofencing permission.
2 Set geofencing
- Geofencing information: Includes geofencing type and geofencing region list.
- Geofencing type: Includes two types: Include and Exclude. The geofencing type will act on the geofencing region list.
- Include: Indicates all regions in the region list are included within the geofencing.
- Exclude: Indicates all regions in the region list are excluded from the geofencing.
Before creating the SDK, call the setGeoFence interface to set geofencing information.
Please configure geofencing information before calling createEngineWithProfile, otherwise it will be invalid.
// Example of setting Include mode
ZegoGeoFenceType geo_fence_type = ZEGO_GEO_FENCE_TYPE_INCLUDE;//Set Include mode
NSMutableArray<NSNumber*> *geo_fence_area = [[NSMutableArray alloc] init]; // Set region list information, at least 1 must be set, at most not greater than the number supported by the SDK
[geo_fence_area addObject:ZEGO_GEO_FENCE_AREA_CODE_CN];
[geo_fence_area addObject:ZEGO_GEO_FENCE_AREA_CODE_NA];
[ZegoExpressEngine setGeoFence:geo_fence_type area:geo_fence_area];// This interface is a static method, called before createEngineWithProfile
// Example of setting Exclude mode
ZegoGeoFenceType geo_fence_type = ZEGO_GEO_FENCE_TYPE_EXCLUDE;//Set Exclude mode
NSMutableArray<NSNumber*> *geo_fence_area = [[NSMutableArray alloc] init];// Set region list information, at least 1 must be set, at most not greater than or equal to the number supported by the SDK
[geo_fence_area addObject:ZEGO_GEO_FENCE_AREA_CODE_CN];
[geo_fence_area addObject:ZEGO_GEO_FENCE_AREA_CODE_NA];
[ZegoExpressEngine setGeoFence:geo_fence_type area:geo_fence_area];// This interface is a static method, called before createEngineWithProfile3 Integrate other features
After completing geofencing settings, you can proceed with other feature integration.
