question

boppl avatar image
boppl asked boppl commented

App Service is being killed on Clover Device

Hey Guys,

Our Clover app runs as a background service which has a persistent icon floating on the screen at all times. (Basically like Facebook Messenger ChatHeads)

Something on the devices is killing this service and it does not restart until the user manually Force Kills our app. than re-opens it. We've tried to simulate this on an emulator, but all stopping of the service and even simulating Android killing the app to free up resources results in our app immediately restarting as expected.

Is there something specific that is causing this issue built into the clover devices? How can we fix this from happening?

Cheers,

Jon.

10 |2000

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

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered boppl commented

I don't know what you mean by a floating icon.

No, Clover doesn't perform any special app / memory management beyond standard Android. One thing to keep in mind is Android will stop restarting your service if it crashes repeatedly. It gets put into a blacklist. Have you verified your app isn't crashing?

There's no way to absolutely guarantee your process won't be killed. The best you can do is to create a foreground service which requires a persistent notification. That being said, keep in mind this is a mobile operating system. Keeping your app running at all times is in most cases not the correct approach. A better solution would be to make your functions available via a notification, possibly with action buttons.

2 comments
10 |2000

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

boppl avatar image boppl commented ·

Thanks for the reply.

We've received no reports of crashes (via crashlytics) from Clover devices.

To be a bit clearer, we're not concerned about the app/service being stopped. It is setup so that it will start when an order notification is triggered from the clover api. This works as expected, however in the cases where the app has stopped by unknown reasons, it fails to start, even when attempted manually by the user. It does not restart until a force close is performed.

Trying to reproduce this on an emulator always results in a restart.

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

If you are listener using an order listener, or listening to content observer updates, your app needs to be running. If you are doing that, then yes you won't be notified when your app is killed. How are you listening? Provide details of how you've designed this.

There are broadcasts for certain order-related events. You could register for these in your manifest which doesn't require your app to be running and listening to receive. If you let me know what exactly for you need to be notified I can see if there's a broadcast for it.

0 Likes 0 ·

Welcome to the
Clover Developer Community