Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

WiFi Manager - some example more?
Started by inforaudio Oct 12 2017 03:32 AM

42 replies to this topic
[TOPIC CONTROLS]
Page 2 of 2 1 2
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

RedBeach

[GLOBAL: userInfoPane.html]
RedBeach
  • Corona Geek

  • 1,132 posts
  • Corona SDK

@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)



[TOPIC: post.html]
#27

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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.



[TOPIC: post.html]
#28

RedBeach

[GLOBAL: userInfoPane.html]
RedBeach
  • Corona Geek

  • 1,132 posts
  • Corona SDK

 

 

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).



[TOPIC: post.html]
#29

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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?



[TOPIC: post.html]
#30

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,769 posts
  • Enterprise

Have you tried making a network connection test yet?

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


[TOPIC: post.html]
#31

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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)

 

 

Attached Files



[TOPIC: post.html]
#32

RedBeach

[GLOBAL: userInfoPane.html]
RedBeach
  • Corona Geek

  • 1,132 posts
  • Corona SDK

@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 



[TOPIC: post.html]
#33

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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 )

3. 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.

 

4. 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



[TOPIC: post.html]
#34

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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



[TOPIC: post.html]
#35

RedBeach

[GLOBAL: userInfoPane.html]
RedBeach
  • Corona Geek

  • 1,132 posts
  • Corona SDK

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


  • Scott Harrison likes this

[TOPIC: post.html]
#36

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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.



[TOPIC: post.html]
#37

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,769 posts
  • Enterprise

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



[TOPIC: post.html]
#38

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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?



[TOPIC: post.html]
#39

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,769 posts
  • Enterprise

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 )


[TOPIC: post.html]
#40

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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?



[TOPIC: post.html]
#41

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

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?



[TOPIC: post.html]
#42

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,769 posts
  • Enterprise

With Android 6.0 you need to request permission in real-time meaning in code. 

See

https://docs.coronalabs.com/api/library/native/showPopup.html#requestapppermission

 

You would need to place this code where appropriate in code 

 

I updated the sample to help

https://github.com/scottrules44/wifiManager-demo/blob/master/main.lua



[TOPIC: post.html]
#43

inforaudio

[GLOBAL: userInfoPane.html]
inforaudio
  • Enthusiast

  • 30 posts
  • Corona SDK

Ok, Thanks for your tips.

Now, we can get that some smartphone connect to the ssid that we need.
But we have some problem with others
For example wiht ZUK Z1 with Lineagos 14.1 - Android 7.1 -

 

If we connect a SSID without Internet, the conection is established, but cant move data, surf etc.. until you answer at a pop up question that like :  This net wifi dont have conection to Internet, do you want to continue conect with this net wifi?  If you check in Yes you can surf, or move data, else nothing.
The problem is that this message only show when go to setting, net wifi, connect to wifi...
If connect with APP , this message never show and cant move data or surf.

 

With a Xiamoi M8 wiht MIUI10 - Android 8.1
Very similar. If you try to connect in a net wifi without internet. Show a pop up question, that show:  this net dont have internet access , do you want continue connect??
Cant move data or surf until answer this question.. If pulse in yes, we can move data or surf with this wifi, else nothing.
But this Question dont show if we cant connect with the APP.

What can i do?

 

We cant upload images of it.




[topic_controls]
Page 2 of 2 1 2
 
[/topic_controls]