0
When you connect to a wifi network that needs authentication, Android sends you to the network authentication page by a redirect usually sent by the link connectivitycheck.gstatic.com/generate_204 or by the link clients3.google.com/generate_204 or similar links.
In the app I’m developing, I want to do it automatically through the app. I want him to get the redirected address and log in to the network using this address.
How can I access these links within the application and get the link to which they redirect, all in the background?
Also, how can I check, at runtime, if the user is logged in and with wifi network access?
Edition to complement: I will describe the situation better in context.
My application has saved the login and password of the user. Thus, it opens internally the wifi login page and login with the saved information. The problem is precisely having known the url.
This problem happens because it is never the same url. It changes with each login attempt, due to the different token that is generated each login.
My goal is to somehow get this url to send to login function, and so know the url to send to the function.
I’ll describe the situation better in context. My application has saved the user login and password. Thus, it opens the wifi login page internally and logs in with the saved information, in a way really very similar to what you presented in your code. The problem is just having known the url. This problem happens because it is never the same url. It changes with each login attempt, due to the different token that is generated with each login. My goal is to somehow get this url to send to the login function, and so know the url to send to the function.
– Otavio Miguel
I believe that if you make an http request to any address [q requires you to be logged in before], in the header or in the body of Sponse (I don’t remember now) the login URL will come (because that’s how the browser finds out which URL to redirect you to). Take a good look at Response, especially its header. So you can get the URL, save it in a variable and make a new http request for it.
– Raphael Stefani
Could you make an example code of how to do this? Just a rough draft would help
– Otavio Miguel
The example from above does not help?
– Raphael Stefani