• Home
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • App Market Developer Platform
  • Clover GO
  • Ideas & Feedback
  • Semi-Integration
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
Skip to main content
  • Create
    • Ask a question
    • Post an idea
    • App Market Developer Platform
    • Clover GO
    • Ideas & Feedback
    • Semi-Integration
    • Topics
    • Questions
    • Articles
    • Ideas
  • Sign in
  • Home
  • App Market Developer Platform

question

Ramya avatar image
Ramya asked · Jul 10 at 11:14 AM

Not able to listen events from OrderV3Connector.OnOrderUpdateListener2

Whenever lineItem added,deleted and updated in Register app, we want to trigger an event
Seen this post https://community.clover.com/questions/14833/is-t... tried code in clover mini sandbox but unable to receive events

We are using below code
Created OrderV3Connector.OnOrderUpdateListener2 as Service
public class LineItemService extends Service implements OrderV3Connector.OnOrderUpdateListener2 {
// order added, delete and other related methods
}

Started service
Intent intent= new Intent(getApplicationContext(), LineItemService.class);
startService(intent);

//Manifest
<service android:name=".activities.LineItemService"/>

clover android sdk gradle
implementation 'com.clover.sdk:clover-android-sdk:221.9'

Please suggest
OrdersSandboxClover Android SDKLineItemsBroadcasts
Comment
0
10 |2000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

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

1 Answer

· Write an Answer
Jeffrey Blattman avatar image
Jeffrey Blattman answered · Jul 10 at 09:41 PM
That's not quite how it works. You'd create a foreground service that adds itself (or some other class that implements OnOrderUpdateListener2) using OrderConnector.addOnOrderChangedListenener().

Note that there's really no reliable way to stay listening forever. If you make your service foreground Android will prefer to keep it in memory, but there are no guarantees.

Alternatively you can register for ACTION_LINE_ITEM_ADDED in your manifest. See class Intents in SDK for documentation. This isn't really great either as it means the OS has to start your app every time a line item is added to an order. In fact if you target later versions of Android they simply do not allow you to listen for such things from a manifest registered receiver.
· 3 comments · Share
10 |2000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

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

Ramya avatar image Ramya · Jul 11 at 12:00 PM

Thanks Jeffrey.

But is there any other option available to listen all events (Item added, updated and deleted)?

0 · ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ Ramya · Jul 11 at 04:55 PM

There is not.

0 · ·
Ramya avatar image Ramya Jeffrey Blattman ♦♦ · Jul 12 at 10:43 AM

Ok, Thanks Jeffrey.

0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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

question details

3 People are following this question.

Ramya follows this question jeff follows this question kcinfuse follows this question
Answers Subscribe to Answers Answers and Comments Subscribe to Comments and Answers

Related Questions

Not able to listen events from OrderV3Connector.OnOrderUpdateListener2 0 Answers

Is there any way to get event when any line item is updated / modifier is added to line item using clover android SDK 1 Answer

Order Total is not updating when I created custom item with negative price from clover sdk 1 Answer

Is there any way to get event when any line item modifier is removed from clover order using clover android SDK. I tried with Broadcast Receivers & OrderV3Connector.OnOrderUpdateListener. 1 Answer

Any luck with priceWithModifiersAndItemAndOrderDiscounts? 1 Answer

Answerhub Logo
  • About
  • ·
  • FAQ
  • ·
  • Privacy
  • ·
  • Copyright © 2010-19 DZone, Inc.