Could you explain your use case for disabling the Sale app from launching?
Our app is a full point-of-sale system. At time of payment, the Clover Flex is handed to the customer. The customer then interacts with our app prior to calling the sale intent. What we are noticing is that if the customer inserts the card before our app calls the sale intent, it starts the sale app before we want it to. We are trying to prevent the Sale app from launching before the intent is called so that we can capture the result of the sale intent. If the customer inserts the card prematurely, the result of the transaction is not passed back to our app.
I see, unfortunately there is not a native way to suppress the sale app from launching upon card insertion. What is it that is keeping the attendant from making sure the customer inserts their card at the time of payment and not prematurely?
Also, you mentioned that your app launches the sale intent. Are you utilizing payment connector for processing payments?
<uses-permission android:name="com.clover.permission.RECEIVE_CARD_INSERTED"/> <uses-permission android:name="com.clover.permission.RECEIVE_CARD_SWIPED"/>2) Create the following service for your app:
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 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) { ALog.d(this, "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)) { ALog.i(this, "Intent suppression background service is suppressing intent: " + action); if (isOrderedBroadcast()) { abortBroadcast(); } } } }; registerReceiver(suppressCardInsertedIntentReceiver, filter); ALog.d(this, "Intent suppression background service broadcast receiver created"); } } @Override public void onDestroy() { if (suppressCardInsertedIntentReceiver != null) { unregisterReceiver(suppressCardInsertedIntentReceiver); suppressCardInsertedIntentReceiver = null; ALog.d(this, "Intent suppression background service broadcast receiver destroyed"); } super.onDestroy(); } @Override public IBinder onBind(Intent intent) { return null; } }
The intent that is being produced is ordered, so you can set your broadcast receiver to intercept the intent and short circuit it.
Payment Connector should be available for development in Canada, and that will be the supported payment endpoint moving forward. Please continue to post your questions on Community or email semi-integrations@clover.comHi Greg.
This seems to be inconsistent after the android 10 update. More information I have posted as a separate question. Please could you check and let us know a solution.
https://community.clover.com/questions/36118/sale-prompt-not-suppression-not-working-after-andr.html
Regards
4 People are following this question.