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 create method; otherwise, the call does not take effect.
// Example of setting union mode
// Set the region list information, at least 1 and no more than the number supported by the SDK
ArrayList<Integer> arrayList = new ArrayList<Integer>();
arrayList.add(2);
arrayList.add(3);
// This interface is called before create
ZIM.setGeofencingConfig(arrayList, ZIMGeofencingType.Include);
// Example of setting exclude mode
// Set the region list information, at least 1 and no more than the number supported by the SDK
ArrayList<Integer> arrayList = new ArrayList<Integer>();
arrayList.add(2);
arrayList.add(3);
// This interface is called before create
ZIM.setGeofencingConfig(arrayList, ZIMGeofencingType.Exclude);
3. Other features
You can enable other features after geofencing is configured.