Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:42:51+00:00 2026-06-13T22:42:51+00:00

I’m trying to scan some access points with class WifiManager (StartScan), this scan occur

  • 0

I’m trying to scan some access points with class WifiManager (StartScan), this scan occur in a touch event but it just makes one scan in each touch. The problem is that I need make this process 10, 20 or the number that I want times; however I don’t know how I can do this. Because I thought that with one for cycle was enough but this method doesn’t work to me.

This is my onTouch method and I need that every time that I touch the screen it repeats 10 times

public boolean onTouch(View v, MotionEvent event) { 
// TODO Auto-generated method stub 
WifiManager w = (WifiManager) getSystemService(Context.WIFI_SERVICE);
texto.setLength(0); 
switch (event.getAction()){ 
case MotionEvent.ACTION_DOWN:
texto.append("down"; posx:(double) event.getX(); posy:(double) event.getY();    
w.startScan(); 
break;
}
return false; 
}

I tried with the next for cycle but didn’t work me

for(int i=1;i <= 10;i++){ 
w.startScan();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:42:53+00:00Added an answer on June 13, 2026 at 10:42 pm

    You need to request the scan and then wait for the results in a BroadcastReceiver , something like this:

            BroadcastReceiver receiver_aps = new BroadcastReceiver()
            {
                @Override
                public void onReceive(Context c, Intent intent) 
                {
                   List<WifiConfiguration> results = wifiManager.getConfiguredNetworks();
                   List<ScanResult> scanResults = wifiManager.getScanResults();   
                }
            };
    
            IntentFilter filter = new IntentFilter();
            filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
            registerReceiver(receiver_aps,filter);  
    

    When the Scan has finished you can then request a scan again (in the BroadcastReceiver) keeping a counter to make sure you only do it ten times.

    Your current code is requesting 10 scans within the time it takes to complete the initial scan so all subsequent scan requests are ignored.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement the Graham Scan in C++ but it doesn't work and
I'm trying to scan some pictures together (personal 3x4 cm images) and then split
I am trying to work on some stuff using the Scanner for input, but
I'm currently trying to import a .txt file into some proprietary software but appear
Learning my way through this stuff and could use some help. I'm trying to
I am currently trying to get ZXing to scan some barcodes. It's doing that
I'm trying to scan all stylesheets within DOM using following each() function $(link).each(function(){ $.get($(this).attr('href'),
I am trying to put some initialization methods in controller's default constructor, but the
Hi i have been trying this for some time now no result yet. i
I'm trying to encapsulate some code to grab and release the onLoad event for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.