Wifi Scanner which scans 20 times

前端 未结 2 560
迷失自我
迷失自我 2021-01-28 05:07

I am trying to make wifi scanner for my project which does 20 scan when I hit the scan button. When I run the code its scans but I dont know it scans for 20 times or not and the

2条回答
  •  滥情空心
    2021-01-28 05:31

    Update: You can take a look at my demo for RF measurements using Android device, where you can found a couple of approaches, here:

    https://github.com/panosvas/Measurements

    where you can find an implementation of WiFi measurements one after another. I have also created a Server for storing these measurements as well as a remote trigger app using UDP packets where you can find here:

    https://github.com/panosvas/IndoorPositioningServer

    It is possible to obtain multiple measurements. Your approach is wrong due to the fact that the for loop will be executed probably in mseconds and each wifi measurement in Android keeps approximately 5 seconds based on the device. One approach to achieve your goal is the following:

    • Create an Asynch task or a task that calls the startScan()
    • Keep a counter and update it each time the onRecieve is triggered
    • If the counter does not reach the limit then inside the onRecieve call again the task
    • If the counter reaches the limit then inside the onRecieve you don't have to call again the task

    Keep in mind that in order to obtain correct measurements you have to wait until each measurement finishes otherwise you will take duplicates of the same measurement.

提交回复
热议问题