I'm new in Android development and I need some help coming with a solution for the following problem: My college's Wi-Fi network has a captive portal that ask for your username and password to access the school's system, so I thought I could automatize the process of logging in the network by sending an HTTP post request to the portal with the user data everytime the phone detects a connection to the school's network (checking the SSID), easy cake, right? The thing is I don't know where to start, Android is a very extensive environment so I'm here to ask you for guidance. I did some homework about it and this is what I've got so far:
- I can start the app using a BroadcastReceiver with the Connectivity Manager Intent. I think it might give me too much intents I don't need, as I just need the Wifi. I read about it here
- I can make HTTP Request using the AndroidHTTPClient.
The flow I'm planning is the following: User opens the application for the first time, and he enters the username and password, there's a toggle button for Auto-Connect that changes to "Disconnect" when you press it (as you can only connect one device at a time with the same credentials, it sends a request to the network's logout page). With the system in Auto-Connect mode, everytime the phone connects to the school network, it should send the request, even if the app is not running.
- First, what's the best approach for this kind of problem??
- Where (and when) should I store the credentials?
- Where should I make the Requests? in the Receiver's onRecive()? in the activity?
I know it's like asking you to solve my problem, but I'm trying to learn here, and I need guidance to make the best I can with this software. I very much appreciate your input :)