question

khurram avatar image
khurram asked Jeffrey Blattman commented

Is there any setting on clover station while working on rest apis

Hi,

We have a native app installed on our clover station which has to keep running all the time on background and keep checking for new updates every 20 seconds.

We have two clover devices against same marchent id and our app is installed on both devices.

On one device our app work perfectly fine and on other it stop working after sometime and then won’t work until we restart that device.

We are using foreground service for this work.

Is there any setting needs to be enabled on device end so it work on both or what can be the problem?

Clover Station
10 |2000 characters needed characters left characters exceeded

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
David Marginian avatar image
David Marginian answered Jeffrey Blattman commented

As Jeff has already mentioned in other threads, there is no guarantee that Android will keep a foreground service running. Can you explain exactly what you are trying to accomplish with your service? Per your comment in another thread: "Our app has to run all the time in background and keep listening for new order coming from our online apps. As soon as a new order comes it should send to printer". Is that all your app/service does? You listen for new orders and print them?

If this is the case you may want to consider a different implementation. One option would be to send a notification from your server when the order is complete (all line items added, payment complete, etc.). The notification payload should include the order id as well as the modified time (modifiedTime on the order response from Clover) and possibly the printer id. Your app can listen for this notification and then look-up the order via OrderConnector. If the Order you retrieve from OrderConnector is before the modifiedTime on the notification you will need to poll OrderConnector until you have the latest order. Please see Jeff's accepted answer here for more information.

6 comments
10 |2000 characters needed characters left characters exceeded

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

Yes that’s all our app do

As soon as a new order comes it should send to printer". Is that all your app/service does? You listen for new orders and print them?

0 Likes 0 ·

Ok, then I think you should follow the suggestions I outlined in the second paragraph above.

0 Likes 0 ·
khurram avatar image khurram David Marginian ♦♦ ·

Thanks. Let us try this

0 Likes 0 ·
Show more comments

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