Silent Mode Related Interfaces
Permanent Silent Mode
You can use the disable() interface to put the SDK into silent mode. The SDK will stop collecting data and will not communicate with the server until you use the enable() interface to cancel the silent mode. Please use with caution according to actual situations. Note: The silent mode will be cached locally, and the SDK will remain in silent mode even after the application is restarted.
- Related Interface
/**
* Call this interface to put the SDK into silent mode
*/
NBSAppAgent.disable()
- Code Example
NBSAppAgent.disable();
Temporary Silent Mode
You can use this interface to put the SDK into temporary silent mode. The SDK will stop collecting data and will not communicate with the server for the specified time period. The unit can be set to days, hours, minutes, or seconds, with a maximum of 30 days. After the silent time is exceeded, the SDK will be restarted with cached configurations for each module. Note: If the application is launched in silent mode and reaches the silent time during runtime, the SDK will remain in silent mode until the application is restarted.
- Related Interface
/**
* @param timeUnit The time unit, supports DAYS, HOURS, MINUTES, SECONDS, etc., with a maximum of 30 days
* @param timeUnit The duration of silent mode
*/
NBSAppAgent.disableTimeUnit(TimeUnit timeUnit, long time)
- Code Example
NBSAppAgent.disableTimeUnit(TimeUnit.DAYS, 2);// Silent for 2 days
Cancel Silent Mode
You can use this interface to cancel the silent mode of the SDK. After calling the silent interface, you need to call this interface to start the SDK. When restarted, the SDK will start each functional module according to the cached configuration.
- Related Interface
/**
* Call this interface to cancel the silent mode of the SDK
*/
NBSAppAgent.enable()
- Code Example
NBSAppAgent.enable();