TWSFactory
A factory for creating and managing instances of TWSManager.
This factory uses a WeakHashMap to cache instances of TWSManager associated with specific tags. Instances are stored as weak references, meaning they will be automatically cleared by the garbage collector when they are no longer in use, ensuring memory efficiency.
Prerequisite: tws-service.json
To use the TWSManager, ensure you have the required tws-service.json
configuration file.
Generate
tws-service.json
and associate it with your TWS accountPlace the
tws-service.json
file in the app module's root directory or the root directory of your desired flavor.
Example Directory Structure:
/app
├── src
│ ├── main
│ │ ├── tws-service.json
│ │ └── AndroidManifest.xml
│ └── flavorName
│ ├── tws-service.json
│ └── AndroidManifest.xml
Functions
Retrieves a TWSManager instance for the default configuration, which is created using metadata from the application's manifest.
Retrieves an existing TWSManager instance by its tag, if available.
Retrieves a TWSManager instance for a custom TWSConfiguration.Basic.
Retrieves a TWSManager instance for a custom TWSConfiguration.Shared.