Guest User

Untitled

a guest
Apr 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public void Running() {
  2. new Handler().postDelayed(new Runnable() {
  3. @Override
  4. public void run() {
  5. tv1.setText("counter : " + time1);
  6. time1++;
  7. Scan_number++;
  8. mwifiManager.startScan();
  9. periodic_recieving_wifi_signals();
  10. Running();
  11. }
  12. }, 1000);}
  13.  
  14. public void periodic_recieving_wifi_signals() {
  15.  
  16. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && checkSelfPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
  17. requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSIONS_REQUEST_CODE_ACCESS_COARSE_LOCATION);
  18.  
  19. } else {
  20. //flag1 = false;
  21.  
  22. registerReceiver(new BroadcastReceiver() {
  23.  
  24. @Override
  25. public void onReceive(Context context, Intent intent) {
  26.  
  27. //tv2.setText("Each scan period is : " + results);
  28. results = mwifiManager.getScanResults();
  29. size = results.size();// number of the elements in the list
  30.  
  31.  
  32. }
  33. }, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
  34.  
  35. }}
Add Comment
Please, Sign In to add comment