we need to trigger an event while order is updated, discount added in order and item added in order.
I am using below code :
public class OrderUpdated extends Service { String TAG = String.valueOf(MyApplication.getAppContext()); @Override public int onStartCommand(Intent intent, int flags, int startId) { new OrderV3Connector.OnOrderUpdateListener2() { @Override public void onOrderUpdated(String orderId, boolean selfChange) { } @Override public void onOrderCreated(String orderId) { } @Override public void onOrderDeleted(String orderId) { } @Override public void onOrderDiscountAdded(String orderId, String discountId) { } @Override public void onOrderDiscountsDeleted(String orderId, List<String> discountIds) { } @Override public void onLineItemsAdded(String orderId, List<String> lineItemIds) { } @Override public void onLineItemsUpdated(String orderId, List<String> lineItemIds) { } @Override public void onLineItemsDeleted(String orderId, List<String> lineItemIds) { } @Override public void onLineItemModificationsAdded(String orderId, List<String> lineItemIds, List<String> modificationIds) { } @Override public void onLineItemDiscountsAdded(String orderId, List<String> lineItemIds, List<String> discountIds) { } @Override public void onLineItemExchanged(String orderId, String oldLineItemId, String newLineItemId) { } public void onPaymentProcessed(String orderId, String paymentId) { } @Override public void onRefundProcessed(String orderId, String refundId) { } @Override public void onCreditProcessed(String orderId, String creditId) { } }; return super.onStartCommand(intent, flags, startId); } @Nullable @Override public IBinder onBind(Intent intent) { Toast.makeText(MyApplication.getAppContext(), "Service Start", Toast.LENGTH_LONG).show(); Log.i(TAG, "SeviceStart" + ""); return null; } }
For start the service :
public void startTheService() { Intent intent= new Intent(getActivity(), OrderUpdated.class); thiscontext.startService(intent); }
In Manifest :
<service android:name=".global.OrderUpdated"/>
I tried it but unable to receive any event .
Please suggest, Thanks in advance.