Skip to main content

SDK Silence

Permanent Silence

You can put the SDK into a silent state by calling the disable API. The SDK will stop collecting data and will no longer communicate with the server until you call the enable API to exit the silent state. Please use this feature with caution according to your actual needs. Note: The silent state is cached locally. After restarting the application, the SDK will remain in the silent state.

  • Related API
/**
* Disable the SDK. Takes effect on next launch, disables upload immediately.
*/
+ (void)disable;
  • Code Example
- (void)doSomething
{
...
[NBSAppAgent disable];
...
}

Temporary Silence

You can put the SDK into a temporary silent state by calling this API. The SDK will stop collecting data and will not communicate with the server within the set time range. The unit can be set to day, hour, minute, or second. The maximum time is 30 days. After the silence period, the next launch will start the SDK modules according to the cached configuration. Note: If the application is in a silent state at startup and the silence period is reached during runtime, the SDK will remain in the silent state until the application is restarted.

  • Related API
/**
* @brief Disable the SDK for a limited time
* @param unit Time unit
* @param duration Duration
*/
+ (void)disableTimeUnit:(NBSTimeUnit)unit duration:(NSInteger)duration;
  • Code Example
- (void)doSomething
{
...
[NBSAppAgent disableTimeUnit:NBSTimeUnitHour duration:2];
...
}

Cancel Silence

You can use this API to cancel the silent state of the SDK. After calling the silence API, you need to call this API to start the SDK. On the next launch, the SDK modules will start according to the cached configuration.

  • Related API
/**
* Enable the SDK. Takes effect on next launch.
*/
+ (void)enable;
  • Code Example
- (void)doSomething
{
...
[NBSAppAgent enable];
...
}