AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Android - delete WIFI

Ein Thema von danten · begonnen am 17. Jan 2018 · letzter Beitrag vom 7. Mär 2019
 
Rollo62

Registriert seit: 15. Mär 2007
4.252 Beiträge
 
Delphi 12 Athens
 
#10

AW: Android - delete WIFI

  Alt 22. Jan 2018, 17:07
I found some time to check your demo.

Its hard to check, since I had to cleanup a lot.
I do not use UniDac, etc., so I have to separate some functions first,
and I tried to use with my fixed network ID here.

I assume your main goal is to connect with one network from the http list only, right ?

An my Nexus9 tablet I can move through the preconfigured network list, since I can see their SSID's (I removed saveConfiguration, to not destroy all my settings here).
But after removeNetwork it still connects to a removedSSID.

I'M not sure whether this behaviour is normal, but I lost a lot of time to unscramble the code, so I haven't test unter other settings.
The docs say this is depreceated anyway.
So all I can say now that I can walk through the networkID's, calling removeNewwork, but still my tablet keeps connected, and also will reconnect.


Delphi-Quellcode:
procedure TfrmApp.RemoveWifiList;
var
  WifiManagerObj: JObject;
  WifiManager: JWifiManager;
  ScanResult: JScanResult;
  List: JList;

  //WifiConf: JWifiConfiguration;
  i: Integer;
  netID: integer;
  LWifiConf: JWifiConfiguration;
  LSsid: String;
  LNetId: Integer;
begin
  try
  WifiManagerObj := SharedActivityContext.getSystemService(TJContext.JavaClass.WIFI_SERVICE);
  WifiManager := TJWifiManager.Wrap((WifiManagerObj as ILocalObject).GetObjectID);

  Memo1.Lines.Insert(0, 'RemoveWifiList:');

  List := WifiManager.getConfiguredNetworks;

  for i := 0 to List.size -1 do
  begin

    LWifiConf := TJWifiConfiguration.Wrap( List.get(i) );
    LSsid := JStringToString( LWifiConf.SSID );
    LNetId := LWifiConf.networkId;

    Memo1.Lines.Insert(0, '- SSID: ' + LSsid + ' ID(' + LNetId.ToString + ') REMOVED');

    WifiManager.removeNetwork( LNetId );
// WifiManager.saveConfiguration(); // TEST this is maybe missing to store permanently


  end;
  except
    on E: exception do
    begin
      ShowMessage('Remove: '+E.Message);
    end;
  end;

...

end;

Rollo
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:26 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz