Menu

Patches Welcome #4: I Needed My Dependency to Shut Down Cleanly, So I Patched It
📰

Patches Welcome #4: I Needed My Dependency to Shut Down Cleanly, So I Patched It

DEV Community: flutter·Sagar Ghag·3 days ago
#Lyl38ADl
#devtoflutter#devto#dev#tracelet#headless
Reading 0:00
15s threshold

My app's GPS tracking service kept running after an FCM silent push triggered auto-punchout. The app was killed. The background handler ran, punched the user out, and tried to stop the GPS service. The service ignored it. Battery drained until the user manually opened the app.

The problem wasn't in my code. It was in Tracelet, the GPS tracking library I depend on.

Why Tracelet.stop() doesn't work from a headless isolate

Tracelet is a Flutter GPS tracking library by Ikolvi. My app (Zontra, a field-workforce tracking platform) uses it for all location capture. Tracelet.stop() works fine when called from the main isolate. It uses Pigeon-generated bindings to talk to the native Android service.

Pigeon doesn't work from headless isolates. When Firebase Cloud Messaging delivers a silent push to a killed app, Android spins up a headless Dart isolate with no Flutter engine attached. The Pigeon channel isn't registered there.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.