Enabling Connection Keep-Alive
                The Connection Keep-Alive feature gives you the option to keep the connection to the card reader established after the first transaction has been completed. Subsequent transactions will use the already connected reader, allowing your merchants to take card payments even faster. 
This feature is designed for setups in which the card reader is connected to a power source most of the time. If your merchant wants to run the card reader mostly on battery power, you need to implement some basic power management using the explicit disconnect method described below.
Enabling Connection Keep-Alive
Set 
keepAlive
 to YES
 in the MPAccessoryParameters
 you supply:[MPAccessoryParameters externalAccessoryParametersWithFamily:MPAccessoryFamilyMiuraMPI protocol:@"com.miura.shuttle" optionals:^(id optionals) {[optionals setKeepAlive:YES];}];
After the first transaction has been completed, the card reader will remain connected and display the idle screen. If you then use the same 
MPAccessoryParameters
 for subsequent transactions, the already connected reader will be used.From SDK version 2.19 onward, you can also customize the idle screen text shown on the reader through the 
MPAccessoryParameters
.Each connection to the reader is tied to an instance of the 
MPTransactionProvider
. In order to use the Connection Keep-Alive feature, you have to create a single instance of MPTransactionProvider
 once during application start up and use that instance for interacting with the SDK throughout the application.Disconnecting from the Card Reader
Through the 
MPAccessoryModule
 in the MPTransactionProvider
 you can disconnect from a connected reader explicitly. This is especially useful when you are running the card reader on battery power and want to disconnect after a certain idle time or situation such as the merchant logging out of the POS system.MPAccessoryModule *accessoryModule = transactionProvider.accessoryModule; MPAccessory *accessory = [[accessoryModule connectedAccesories] firstObject]; [accessoryModule disconnectFromAccessory:accessory statusChanged:^(MPAccessoryProcess *accesoryProcess, MPAccessory *accessory, MPAccessoryProcessDetails *details) { // status updates on the disconnect process } completed:^(MPAccessoryProcess *accesoryProcess, MPAccessory *accessory, MPAccessoryProcessDetails *details) { if (details.state == MPAccessoryProcessDetailsStateFailed) { NSLog(@"Disconnect failed with error: %@", details.error); } else { NSLog(@"Disconnect success"); } }];
Enabling Connection Keep-Alive
                The Connection Keep-Alive feature gives you the option to keep the connection to the card reader established after the first transaction has been completed. Subsequent transactions will use the already connected reader, allowing your merchants to take card payments even faster. 
This feature is designed for setups in which the card reader is connected to a power source most of the time. If your merchant wants to run the card reader mostly on battery power, you need to implement some basic power management using the explicit disconnect method described below.
Enabling Connection Keep-Alive
Set 
keepAlive(...)
 to true
 in the AccessoryParameters
 you supply:AccessoryParameters params = new AccessoryParameters.Builder(AccessoryFamily.MIURA_MPI). bluetooth().keepAlive(true).build();
After the first transaction has been completed, the card reader will remain connected and display the idle screen. If you then use the same 
AccessoryParameters
 for subsequent transactions, the already connected reader will be used.You can customize the idle screen text shown on the reader through the 
AccessoryParameters
 as well.Each connection to the reader is tied to an instance of the 
TransactionProvider
. In order to use the Connection Keep-Alive feature, you have to create a single instance of TransactionProvider
 once during application start up and use that instance for interacting with the SDK throughout the application.Disconnecting from the Card Reader
Through the 
AccessoryModule
 in the TransactionProvider
 you can disconnect from a connected reader explicitly. This is especially useful when you are running the card reader on battery power and want to disconnect after a certain idle time or situation such as merchants logging out of the POS system.AccessoryModule accessoryModule = transactionProvider.getAccessoryModule(); Accessory accessory = accessoryModule.getConnectedAccessories().get(0); accessoryModule.disconnectFromAccessory(accessory, new AccessoryDisconnectListener2() { @Override public void onStatusChanged(AccessoryProcess process, Accessory model, AccessoryProcessDetails processDetails) { // status updates on the ongoing process } @Override public void onCompleted(AccessoryProcess process, Accessory model, AccessoryProcessDetails processDetails) { // disconnection finished, check the process details for the outcome if (processDetais.getState() == AccessoryProcessDetails.FAILED) { Log.d(TAG, "disconnect failed: " + processDetais.getError()); } else { Log.d(TAG, "disconnect success"); } } });