How Two Android Intent Bugs Broke My App’s Red Alert Button
My Android app's emergency button failed three ways: two opposite Intent races and a usability trap. The fix, with code, from a real app built for my mother.
The Android app named CareVocal was created for the author's mother who lives in a village and communicates with family living in cities. The app has three buttons: green for feeling good, yellow for something hurts, and red for needing help. The red button fails to work correctly due to two bugs. The first bug occurs when two intents, one opening the SMS app and the other opening the dialer, are launched back-to-back.
Due to the OS's window transition, only the last intent survives, leaving only the dialer open. The second bug arises when a delay is added between the intent launches. During this brief pause, the SMS app takes the foreground, blocking the second intent from launching. To fix the second bug, the code should use a single call that launches both the SMS and dialer as one operation, ensuring the dialer is the visible option.
The third issue is the recording feature that starts automatically after the first tap, which fails when the user is dizzy or unable to speak. The solution is to separate the recording function, allowing the first tap to handle only safe actions like saving the entry and pre-filling the dialer, while starting the recording on a second deliberate tap.
The author emphasizes the importance of testing failure paths on real devices with real data to avoid hidden bugs in the development process.
Written by urgent.news from HackerNoon's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.