Skip to content

Add WiFi scan shutdown hook for Android detector#4

Merged
nbschultz97 merged 1 commit intomainfrom
codex/add-stopscan-method-and-override-ondestroy
Sep 11, 2025
Merged

Add WiFi scan shutdown hook for Android detector#4
nbschultz97 merged 1 commit intomainfrom
codex/add-stopscan-method-and-override-ondestroy

Conversation

@nbschultz97
Copy link
Owner

Summary

  • add stopScan() to DroneSignalDetector to remove callbacks and unregister the WiFi receiver
  • invoke detector.stopScan() from MainActivity.onDestroy
  • allow app/ directory to be tracked in git

Testing

  • ./gradlew test (fails: No such file or directory)

https://chatgpt.com/codex/tasks/task_e_68c331b97ea48328ba7bdf51698d89d0

@nbschultz97 nbschultz97 merged commit 3211f9a into main Sep 11, 2025
1 check failed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

fun stopScan() {
handler.removeCallbacksAndMessages(null)
context.unregisterReceiver(receiver)
}

[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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant