Skip to main content

SDK Silence

Permanent Silence

You can put the SDK into silent mode by calling the disable() interface. The SDK will stop collecting data and will no longer communicate with the server until the enable() interface is called to cancel silent mode. Please use this feature with caution according to your actual needs. Note: The silent state is cached locally. After restarting the app, the SDK will remain in silent mode.

  • Related interface
/**
* Call this interface to put the SDK into silent mode
*/
NBSAppAgent.disable()
  • Code example
NBSAppAgent.disable();

Temporary Silence

You can put the SDK into temporary silent mode by calling this interface. The SDK will stop collecting data and will not communicate with the server within the specified time range. The unit can be set to days, hours, minutes, or seconds, with a maximum of 30 days. After the silence period, the SDK will start all modules according to the cached configuration on the next launch. Note: If the app is in silent mode at startup and the silence period ends during runtime, the SDK will remain in silent mode until the app restarts.

  • Related interface
/**
* @param timeUnit Time unit, supports DAYS, HOURS, MINUTES, SECONDS, etc. Maximum is 30 days
* @param time Silence duration
*/
NBSAppAgent.disableTimeUnit(TimeUnit timeUnit, long time)
  • Code example
NBSAppAgent.disableTimeUnit(TimeUnit.DAYS, 2); // Silence for 2 days

Cancel Silence

You can cancel the silent mode by calling this interface. After calling the silence interface, you need to call this interface to restart the SDK. On the next launch, all modules will start according to the cached configuration.

  • Related interface
/**
* Call this interface to cancel SDK silence
*/
NBSAppAgent.enable()
  • Code example
NBSAppAgent.enable();