Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Generated binary assets
app/
__pycache__/
29 changes: 29 additions & 0 deletions app/src/main/java/com/example/dronedetect/DroneSignalDetector.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.example.dronedetect

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.net.wifi.WifiManager
import android.os.Handler
import android.os.Looper

class DroneSignalDetector(private val context: Context) {
private val handler = Handler(Looper.getMainLooper())
private val wifiManager = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
private val receiver = WifiScanReceiver()

fun startScan() {
// TODO: implement scanning logic
}

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

class WifiScanReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
// TODO: handle scan results
}
}
18 changes: 18 additions & 0 deletions app/src/main/java/com/example/dronedetect/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.dronedetect

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {
private lateinit var detector: DroneSignalDetector

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
detector = DroneSignalDetector(this)
}

override fun onDestroy() {
super.onDestroy()
detector.stopScan()
}
}
Loading