While our app is in the CustomerMode, we have added a service to run in the background and suppress the Sale prompt that appears when you dip or swipe a card. This worked fine previously but after the Android 10 upgrade, it seems like the issue has reappeared.
Our service is written as below.
public class IntentSuppressionService extends Service { private static final String ACTION_BROADCAST_CARD_INSERTED = "com.clover.intent.action.broadcast.CARD_INSERTED"; private static final String ACTION_BROADCAST_CARD_SWIPED = "com.clover.intent.action.broadcast.CARD_SWIPED"; private static final int PRIORITY_INTERCEPT = 200; private static String TAG = IntentSuppressionService.class.getName(); private BroadcastReceiver suppressCardInsertedIntentReceiver = null; public static void start(Context context) { context.startService(new Intent(context, IntentSuppressionService.class)); } public static void stop(Context context) { context.stopService(new Intent(context, IntentSuppressionService.class)); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "Intent suppression background service is starting"); return START_STICKY; } @Override public void onCreate() { IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_BROADCAST_CARD_INSERTED); filter.addAction(ACTION_BROADCAST_CARD_SWIPED); filter.setPriority(PRIORITY_INTERCEPT); if (suppressCardInsertedIntentReceiver == null) { suppressCardInsertedIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent != null ? intent.getAction() : null; if (ACTION_BROADCAST_CARD_INSERTED.equals(action) || ACTION_BROADCAST_CARD_SWIPED.equals(action)) { Log.i(TAG, "Intent suppression background service is suppressing intent: " + action); if (isOrderedBroadcast()) { abortBroadcast(); } } } }; registerReceiver(suppressCardInsertedIntentReceiver, filter); Log.d(TAG, "Intent suppression background service broadcast receiver created"); } } @Override public void onDestroy() { if (suppressCardInsertedIntentReceiver != null) { unregisterReceiver(suppressCardInsertedIntentReceiver); suppressCardInsertedIntentReceiver = null; Log.d(TAG, "Intent suppression background service broadcast receiver destroyed"); } super.onDestroy(); } @Override public IBinder onBind(Intent intent) { return null; } }
The sale screen appears intermittently. Are we missing any new intent?