WiFi Manager - some example more?

thanks so. How i manage it?

like:  if (wifiManager.ping  == true) 

if (wifiManager.ping (192.168.4.1)???

The pop up show 2 - 3 second after connect to the wifi networks, try to connect or not.

I looking for information and only succes in Android 6 and 7, and some version of 5…  There are other version of Android that dont show it…

I don’t know about versions less then 5.0, I don’t have device less than that. If should be

if (wifiManager.ping() == true) then

It should check wifi. I am not familiar with that popup. I am an iOS user.

@inforaudio, I am pretty sure that popup you see is custom made (by the android system or the developer).

So, if you are inside your app and you connect to a wifi that does not have internet connection, it is up to you to show a popup for the user.

If the Yes/No button of the popup is making any difference if you can reach another device in the network, that is probably being managed by the app itself.  If you have your own app and you connect to a wifi, you should be able to connect to other devices on that network regardless the internet connections status.

of course that the message is generate by Android system.

We try in other smartphones with Android 7.0 and in all system ask about the connect to the network or not . when there are not internet conection. And there are not data transfer , to pulse yes.

How can generate this message with Corona sdk? Really how can confirm it?

About the new function of wifimanager (ping) only confirm is there are transfer data or not. But dont solved the problem of message and connection.

The bigger problem is that the message dont show is connect with wifimanager plugin. Then there are not data tranfer

There is a network library to test connections

https://docs.coronalabs.com/api/library/network/index.html

@inforaudio, it appears that you are with the impression that it is the popup that gives you network connection (and thus you want to make it appear on the screen). That is probably not the case. The popup is just a reaction of the system to that state (no connection).

What might be happening is that you say that you do want to keep the current connection, the system disconnects from it and so you are not able to communicate with the other devices. But I do not believe that is that acceptance of that popup that is making the connection the active (it is more like: if user accepts, do nothing, if he not accepts, disconnect)

Not, Run different, i explain better.

You connect to a wifi network without ( internet access.

Android connect,  in Setup/wifi, show connect to this wifi, and in few seconds show the message. (This network dont have internet access. do you want to keep connect to the network?)

If ignore and try to transfer data, (browser, ping, etc…)  there are not connection, all blocked…

If looking for the message and check in YES, (continue connect to the wifi network), all run properly (browser ok, ping ok).

When try to connect to Wifimanager Plugin, the messager dont show, then the connect is no possible.

We need force that connect to the network…

With Wifi manager plugin connect to the wifi network, in setup/wifi, show conectec, but there are no trafic data.

If connect with a wifi network with internet access with wifimanager plugin, all is correct.

When try to connect to Wifimanager Plugin, the messager dont show, then the connect is no possible.

The message does not appear because it is up to you to create and show it.  But showing it or not should not have any impact on the connection status.

The problem that you should focus is: Why I am not able to connect to my other device if I am already connected to the wifi?  The popup appearing or not should not any impact on this.

Try the following: After connecting to the wifi using the wifimanager plugin, print your IP and check if it is a correct value (i.e, if you have an IP within the same subnet of your other devices).

Exactly, until i dont press yes, the smartphone dont have IP.

If connect with Wifimanager or if connect manual by setup/wifi …

When press yes, Android system get a ip.

If configure the wifi network force a ip address, is the same, there are no connect , and the ip dissapear

How can solved it?

Have you tried making a network connection test yet?

network.request( "http://192.168.4.1", "GET", function(e) end )

We test it:  

local function networkListener( event )         
                  if ( event.isError ) then
                      print( "Network error: ", event.response )
                      titulo4 = display.newText("Error de Red  " … event.response, 140, 180,native.systemFontBold, 5)            
                  else
                      print ( "RESPONSE: " … event.response )
                      titulo4 = display.newText("Respuesta " … event.response , 140, 180,native.systemFontBold, 5)
                  end
              end   
   
            network.request( “http://192.168.4.1”, “GET”, networkListener )

end

same problem.

The answer is here:

Answer a network error.

The browser dont answer nothing.

And in upper part, signal wifi is without internet connection.

if previously, we connect manually to the net without internet access, and press yes into the message.And try again, the answer of the function is true  ( the http code of 192.168.0.146)

@inforaudio, a few questions:

  1. What is the IP address of the device that you want to connect to? 

  2. Is that device listening to port 80? (I noticed on your last screenshot that you are trying to access it via browser)

  3. After connecting to the wifi router using the Wifimanager plugin, please exit the app and go to your Android Wifi settings. What do you see there? Do you see that you are connected without internet access?

  4. What is the IP address that you received? (You can see that IP under “About phone/tablet” -> Status -> IP Address 

  1. the ip of device is 192.168.4.1

  2. Yes, the device is listening in 80 port.   If before of run app with wifimanager, connect manually to wifi network. The device answer properly. 

(yes in the screnshot, upper is a corona app, try to access to wifi network of made this device, lower with a brower, try to connect to device )

  1. if we connect to a wifi con internet access with wifimanager, all is ok…  GEt a ip and all is perfect inside APP or outside APP.

  2. The problem that i checking is: if connect to wifi network without internet access with wifimanager never get IP. But only have problem with a smartphone with LINEAGEOS and android 7.1.2.

We test in other telephone with android 7 and good.  When ttry to connect to wifi without internet with wifimanager show the message, confirm Ok, and all perfect…

A made a question:

Really what looking for Android for know if there or there are not internet conection in this wifi.
With IOT device, we can made a DNS and other things for deceive android

We have other problem with the plugin…

wifiManager.getScanResults() dont run in Android 7.0

Only can test in Android 4.x and in it run properly.

local results = wifiManager.getScanResults()
 
 if (#results>0 ) then
   for i=1, #results do
     enc=0
     if (results[i][“ssid”] == name_ssid ) then
      enc = 1
     end
     titulo2 = display.newText("-" … i … results[i][“ssid”] , 140,( i*20) + 130,native.systemFontBold, 10)
            
   end
end

Are you requiring the LOCATION permission before running the getScanResults()?

With the time we need more feature.

Is possible made a Access Point Wifi with this library?

Is possible made a Access Point with Corona sdk?? Are there some library or pluging?

Thanks.

This plugin( wifi manager) is made to connect to wifi networks. There are no plugins that I know of that do this

hello.

We have some problem with the plugin WifiManager.
In some Android smartphone version, the telephone change the SSID wifin conection very good.

But in other model of Android Smartphone is no possible change it. Dont run, dont made nothing.
WHy?? How can solved this problem? What can i do?

On newer versions (6.0+) you need to ask for permission

local options =

{

   appPermission = “android.permission.ACCESS_WIFI_STATE”

}

native.showPopup( “requestAppPermission”, options )

In where part can i put it? build.setting  config.lua???


 

we try to put into Main.lua but the smartphone dont ask to me nothing…

So we add “android.permission.ACCESS_WIFI_STATE”,  to build.setting but nothing

Dont ask and nothing, and the smartphone dont connect to the SSID that we want.

What can i do??  Can you send me a example of code?