I created a service that will listen to the onOrderUpdated, which is working and the callback will be triggered every time when order get touched. I am able to get the orderId but when I try to call orderConnector.getOrder(String orderId) in the callback. It will show the RemoteException.
I was wondering how to get the order detail every time when the order updated?
public class OrderConnectorService extends Service { private Account mAccount; private OrderConnector orderConnector; private OrderChangeListener orderChangeListener; private class OrderChangeListener implements OrderV31Connector.OnOrderUpdateListener { @Override public void onOrderUpdated(String orderId, boolean selfChange) { Log.d("OrderChangeListener", orderId); Log.d("OrderChangeListener", String.valueOf(selfChange));<br> // I am able to get orderId and selfChange boolean flag<br> // Trying to call orderConnector.getOrder here but failed } } @Override public int onStartCommand (Intent intent, int flags, int startId) { mAccount = CloverAccount.getAccount(this); if(mAccount != null && orderConnector == null) { orderConnector = new OrderConnector(this, mAccount, null); orderChangeListener = new OrderChangeListener(); orderConnector.addOnOrderChangedListener(orderChangeListener); orderConnector.connect(); } return START_NOT_STICKY; } @Override public void onDestroy () { orderConnector.disconnect(); if(orderChangeListener != null) { orderConnector.removeOnOrderChangedListener(orderChangeListener); } orderConnector = null; } @Override public IBinder onBind(Intent intent) { return null; } }
There is another BroadcastReceiver will captured "OrderCreated" intent and call startService of above service.