Deprecation Notice - Barcode scanning using intents in Clover Android SDK - April 20, 2017
Due to a recent ROM update on Clover devices to ensure a more reliable merchant experience, the Intents.ACTION_SCAN
broadcast for barcode scanning in our Android SDK has been deprecated. Apps should instead use the BarcodeScanner
class for barcode scanning. The startScan()
method supports passing in the same extra data used in the Intents.ACTION_SCAN
broadcast. Please refer to the following sample code:
private static Bundle getBarcodeSetting(final boolean enabled) {
final Bundle extras = new Bundle();
extras.putBoolean(Intents.EXTRA_START_SCAN, enabled);
extras.putBoolean(Intents.EXTRA_SHOW_PREVIEW, enabled);
extras.putBoolean(Intents.EXTRA_SHOW_MERCHANT_PREVIEW, enabled);
extras.putBoolean(Intents.EXTRA_LED_ON, false);
return extras;
}
public void startBarcodeScanner(){
final Intent intent = new Intent(Intents.ACTION_SCAN);
intent.putExtras(getBarcodeSetting(true));
sendBroadcast(intent);
}
public void stopBarcodeScanner(){
final Intent intent = new Intent(Intents.ACTION_SCAN);
intent.putExtras(getBarcodeSetting(false));
sendBroadcast(intent);
}
private static Bundle getBarcodeSetting(final boolean enabled) {
final Bundle extras = new Bundle();
extras.putBoolean(Intents.EXTRA_START_SCAN, enabled);
extras.putBoolean(Intents.EXTRA_SHOW_PREVIEW, enabled);
extras.putBoolean(Intents.EXTRA_SHOW_MERCHANT_PREVIEW, enabled);
extras.putBoolean(Intents.EXTRA_LED_ON, false);
return extras;
}
public boolean startBarcodeScanner() {
return new BarcodeScanner(this).startScan(getBarcodeSetting(true));
}
public boolean stopBarcodeScanner() {
return new BarcodeScanner(this).stopScan(getBarcodeSetting(false));
}
Updated almost 4 years ago