destroy
Call the destroy API to deinitialize the Alipay+ Tap to Pay SDK. Call it when the login session expires.
In addition to closing the connection, the destroy API performs the following actions:
- Removes all SPI plugins registered through the registerPlugin API.
- Removes all TransactionListener, TokenStatusListener, and ActivateStatusListener instances.
- Shuts down the internal transaction callback executor.
- Releases the SDK instance and returns the SDK to the uninitialized state.
Any existing reference to ACTapManager becomes invalid after destroy is called. To use the SDK again, obtain a fresh instance and follow the steps in Reinitialize after destroy.
Method signature
void destroy();Request parameters
N/A
Response parameters
N/A
Reinitialize after destroy
After destroy is called, the SDK returns to the uninitialized state. The existing ACTapManager reference becomes invalid, and all registered plugins and listeners are removed. To use the SDK again, you must go through the full initialization sequence.
Perform the following five steps in order. Skipping or reordering any step may cause the SDK to behave unexpectedly.
// 1. Obtain a new instance. The previous reference is no longer usable.
ACTapManager manager = ACTapManager.getInstance(getApplication());
// 2. Initialize again.
manager.init(config);
// 3. Re-register every SPI plugin. All plugins were removed by destroy.
// Register all SPIs your integration uses. The example shows all available SPIs.
manager.registerPlugin(NFCRequestProxy.class, new YourNetworkProxy());
manager.registerPlugin(LoggerProxy.class, new YourLogger());
manager.registerPlugin(ThreadPoolService.class, new YourThreadPool());
manager.registerPlugin(ConfigProxy.class, new YourConfigProxy());
manager.registerPlugin(TransactionPermit.class, new YourTransactionPermit());
manager.registerPlugin(NFCMonitor.class, new YourMonitor());
manager.registerPlugin(DeviceFingerPrintService.class, new YourDeviceFingerPrint());
manager.registerPlugin(EncryptionProxy.class, new YourEncryptionProxy());
// 4. Re-set every listener. All listeners were removed by destroy.
manager.setTransactionListener(new YourTransactionListener());
// 5. Connect.
manager.connect(userId, null);Note: If a session expiry does not require releasing plugins and listeners, call disConnect instead of destroy. The disConnect API returns the SDK to the initialized state and keeps your plugins and listeners registered.
Sample
ACTapManager manager = ACTapManager.getInstance(this.getApplication());
manager.destroy();