Add WiFi scan shutdown hook for Android detector#4
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
[P1] Guard against unregistering unregistered Wi‑Fi receiver
In DroneSignalDetector.stopScan() the code unconditionally calls context.unregisterReceiver(receiver) even though startScan() never registers receiver and MainActivity.onDestroy() invokes stopScan() on every exit. On Android, calling unregisterReceiver for a receiver that was never registered throws IllegalArgumentException, so the app will crash as soon as the activity is destroyed unless scanning was started beforehand. Consider tracking a registration flag or wrapping the unregistration in a try/catch so that destroying the activity without an active scan does not crash the app.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
Summary
stopScan()toDroneSignalDetectorto remove callbacks and unregister the WiFi receiverdetector.stopScan()fromMainActivity.onDestroyapp/directory to be tracked in gitTesting
./gradlew test(fails: No such file or directory)https://chatgpt.com/codex/tasks/task_e_68c331b97ea48328ba7bdf51698d89d0