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
Antwort Antwort
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#1

AW: Android - delete WIFI

  Alt 18. Jan 2018, 09:29
Thank you, I uploaded the project as an attachment.
Angehängte Dateien
Dateityp: 7z wifi.7z (243,3 KB, 20x aufgerufen)
Daniel
  Mit Zitat antworten Zitat
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#2

AW: Android - delete WIFI

  Alt 19. Jan 2018, 16:48
Hello, I have tried all the options according to the help but still do not have a functional application.

You really do not know why it does not work.

I set all permissions in permission and it does not work either.
Daniel
  Mit Zitat antworten Zitat
Rollo62

Registriert seit: 15. Mär 2007
4.208 Beiträge
 
Delphi 12 Athens
 
#3

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
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#4

AW: Android - delete WIFI

  Alt 26. Jan 2018, 19:35
It does not work, it only shuts down and does not delete saved connection settings.

Delphi-Quellcode:
procedure TfrmApp.RemoveWifiList;
var
  WifiManagerObj: JObject;
  WifiManager: JWifiManager;
  List: JList;
  i: Integer;
  LWifiConf: JWifiConfiguration;
  LSsid: String;
  LNetId: Integer;
begin
  try
  WifiManagerObj := SharedActivityContext.getSystemService(TJContext.JavaClass.WIFI_SERVICE);
  WifiManager := TJWifiManager.Wrap((WifiManagerObj as ILocalObject).GetObjectID);

  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;

    WifiManager.removeNetwork( LNetId );

    WifiManager.disableNetwork(LNetId);

    WifiManager.disconnect;
    WifiManager.saveConfiguration();

  end;

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

end;
Daniel

Geändert von danten (26. Jan 2018 um 19:59 Uhr)
  Mit Zitat antworten Zitat
localhost

Registriert seit: 7. Dez 2005
Ort: Dortmund
14 Beiträge
 
#5

AW: Android - delete WIFI

  Alt 7. Mär 2019, 14:27
i have the same Problem. The Result from "removeNetwork" is False.

Developer.Andoird says: "Applications are not allowed to remove networks created by other applications." so my app can not delete everything?

Geändert von localhost ( 7. Mär 2019 um 14:30 Uhr)
  Mit Zitat antworten Zitat
mjustin

Registriert seit: 14. Apr 2008
3.010 Beiträge
 
Delphi 2009 Professional
 
#6

AW: Android - delete WIFI

  Alt 7. Mär 2019, 14:43
i have the same Problem. The Result from "removeNetwork" is False.

Developer.Andoird says: "Applications are not allowed to remove networks created by other applications." so my app can not delete everything?
Correct, see

- https://stackoverflow.com/questions/...rogramatically
- https://developer.android.com/about/...havior-network
Michael Justin
  Mit Zitat antworten Zitat
Rollo62

Registriert seit: 15. Mär 2007
4.208 Beiträge
 
Delphi 12 Athens
 
#7

AW: Android - delete WIFI

  Alt 7. Mär 2019, 16:47
So if we are not allowed to change the Wifi network,
maybe there is any alternative method, which asks the user to change the network ?

I think an app should be able to tell what "preferred" network it should use,
and Google probably put something like special permission dialog in ?
  Mit Zitat antworten Zitat
Antwort Antwort


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 09:19 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