logo
In-app Chat
SDK Error Codes
Powered Byspreading
On this page

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 regionUser regionAccess regionImpact on user experience
EuropeEuropeEuropeNo impact
EuropeChinaEuropeMay be significantly affected
Warning
  • 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.

Note

To set other regions, contact ZEGOCLOUD Technical Support.

RegionEnumerationValue
Chinese mainlandCN2
North AmericaNA3
Europe, including the UKEU4
Asia, excluding the Chinese mainland and IndiaAS5
IndiaIN6

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.
Warning

Configure geofencing information before calling the create method; otherwise, the call does not take effect.

Union mode example
Exclude mode example
  // 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);
1
Copied!
  // 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);
1
Copied!

3. Other features

You can enable other features after geofencing is configured.

Previous

Receive tip messages

Next

Reply to a message