question

joselp21 avatar image
joselp21 asked joselp21 answered

Error in production environment getting by the approval team. (Service Intent must be explicit)

Hi,

I have an application that add a discount using the OrderConnector, Here is a portion of the code:

AsyncTask<Void, Void, Void> task =  new AsyncTask<Void, Void, Void>() {
    @Override
    protected Void doInBackground(Void... params) {
        OrderConnector orderConnector = new OrderConnector(activity, CloverAccount.getAccount(activity), null);
        
        try {
            String orderId = activity.getIntent().getStringExtra(Intents.EXTRA_ORDER_ID);
           orderConnector.connect();

           Discount discount = new Discount();
           discount.setAmount(-200L);
           discount.setName(description);
 
           orderConnector.addDiscount(orderId, discount);

        } catch (Exception _e) {

                message.append("Kiosk clover: " + "rootCause: '" + _e.toString() + "'");
            _e.printStackTrace();
        } finally {

            orderConnector.disconnect();
        }

        return null;
    }

}.execute();

This code works fine in my sandbox account, but the approval team is getting the follow error:

'java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.clover.intent.action.ORDER_SERVICE_V3 (has extras) }'

I believe that the error is in the line:
orderConnector.addDiscount(orderId, discount);

I'm getting this error in the catch and then I send it to a endpoint were I log the message.

Anyone has seen that error and why I'm not getting this in my sandbox environment? I'm using clover sdk 117
Clover Android SDK
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dan avatar image
Dan answered
Updating the clover-android-sdk should fix the issue. Looks like the fix was in version 168 (latest version is 221), commit 0a3330b on Mar 24, 2017.

I forget the details, but I think that for Flex and later devices, Android requires an explicit service intent.

Also, you may want to switch from OrderConnectorV3 to OrderConnectorV31.
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

joselp21 avatar image
joselp21 answered
Thanks Dan,

I going to update the sdk version and use the new OrderConnectorV31
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community