customerTenderButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PackageManager pm = getContext().getPackageManager(); ComponentName compName = new ComponentName(getContext().getPackageName(), getContext().getPackageName() + ".CustomerTenderActivity"); if (pm.getComponentEnabledSetting(compName) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) { pm.setComponentEnabledSetting( compName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); Toast.makeText(getContext(), "CUSTOMER TENDER DISABLED", Toast.LENGTH_SHORT).show(); } else { pm.setComponentEnabledSetting( compName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); Toast.makeText(getContext(), "CUSTOMER TENDER ENABLED", Toast.LENGTH_SHORT).show(); } } });
Thanks for the thorough answer - that is very useful. Will give that a shot!
No problem! Let me know if it does not work for you, I also edited the answer, as I realized it is not needed to delete / create the tender, the device will automatically update to add / remove the customer tender based on whether the intent filter is present or not.
<intent-filter> <action android:name="clover.intent.action.MERCHANT_TENDER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
<intent-filter> <action android:name="clover.intent.action.CUSTOMER_TENDER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
Thanks @Raymond Lee - We have both tenders defined in the manifest. However some merchants want to allow the customer facing option and some don't - all require the merchant tender, so a certain level of flexibility is required.
Are you saying that the "Customer Payment Options" section in the device Setup is in fact redundant then and doesn't do anything? I would have expected the "Tenders" section to control the Merchant Tenders and the "Customer Payment Options" to control the Customer Tenders, but in fact both control both - so perhaps the option just shouldn't be there at all, given that it is there though, it seems to me this is a bug. Is that the case and is it likely to be fixed?
If not we will need to look at a workaround and potentially just remove the Customer Tender altogether.
1 Person is following this question.