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
Seite 2 von 2     12   
danten

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

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
 
#12

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.004 Beiträge
 
Delphi 2009 Professional
 
#13

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
3.898 Beiträge
 
Delphi 12 Athens
 
#14

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
mjustin

Registriert seit: 14. Apr 2008
3.004 Beiträge
 
Delphi 2009 Professional
 
#15

AW: Android - delete WIFI

  Alt 7. Mär 2019, 16:52
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 ?
The WiFi settings screen can be invoked from code, so the user may be notified about the preferred network first from your app, and then directed to select it there:

- https://stackoverflow.com/questions/...-using-android

- https://developer.android.com/refere...K_WIFI_NETWORK
Michael Justin

Geändert von mjustin ( 7. Mär 2019 um 16:54 Uhr)
  Mit Zitat antworten Zitat
Rollo62

Registriert seit: 15. Mär 2007
3.898 Beiträge
 
Delphi 12 Athens
 
#16

AW: Android - delete WIFI

  Alt 7. Mär 2019, 16:59
Thanks for the info, would be at least the 2nd best option.
I hoped that I could give a parameter with this intent, but it cannot
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


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 13:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz