I have an Android Application that has to fetch an XML file from a particular URL.
To do this, I first check if an internet connection is available and if so, I download the file. This works fine.
The issue happens when I use my app in a network where users can connect to the internet but need to provide a username and password before they can access any page i.e. Limited Access.
How can I test for Limited Access to the network?
Thanks.
To determine that the user has a fully functioning network connection try to open a web link programmatically in background if you get a success status then internet connection is available else user has limited access.This may help you.Have a look
Related
I've made the leap towards learning AWS and unfortunately have hit an impass, it would seem.
When attempting to launch my application, I'm receiving a notification of
"Failed to retrieive application JMX service URL".
The peculiar thing about this is, my connection is successfully authenticated via AWS and Workbench, however when launching the application it's seemingly attempting to connect with a different usernam specified in appliation.properties or anywhere else for that matter.
Although not good practice, I've been attempting to connect via my admin account through AWS which is further mirrored within workbench, however the error returned is specifying my IRL name which isn't specified anywhere other than the "Remote Management" panel in DB connections within workbench.
This being SSH connectivity url, which is specified never to be used.
I'm unsure whether or not this is where it's being read from, although certain it's the only place being referenced.
I've made an attempt at disabling this, which it currently is - Still reads the same name.
I've made attempts at creating and granting authorities to a user of this username within my DB and still no avail.
java.sql.SQLException: Access denied for user 'removed for safety' (using password: YES)
The above is the error returned, which again specifies a username not declared anywhere for use (other than SSH remote management which is unused) and an IP address which is unrecognised.
Following creation of a new user within both AWS and mySQL DB the error message changes to the following:
java.sql.SQLException: null, message from server: "Host' is not allowed to connect to this MySQL server"
Any help would be greatly appreciated as I've now tried everything within my currently limited knowledge base.
Attempted configuring user within AWS and mySQL matching credentials attempting access - Hoping authorisation would be granted, although simply changed the error message.
Conducted research, although not coming across anything related to AWS/mySQL connectivity related, or varying issues.
I rebuilt both mySQL and AWS in the exact same way and it's now working.
Unsure as to what or why, but there's quite literally no amendments in settings, or code for that matter.
My Android app uses curl to make network calls. I want to find out how I can get the URL that's present in the WiFi proxy auto config in an android device, inside of my application to actually be able to route the charles call through the proxy URL retrieved from the PAC file ?
This question is old, but this might be interesting for anyone else coming from search engines:
Do you know which URL the PAC resides on? If not, I would try to connect to the same WiFi with a PC and do a wireshark trace. When you initiate the connection to the WiFi, an option 252 is sent with the DHCP-lease, specifying where to download the PAC-file from. For example, your client might be told to download http://pac.yoursite.com/pac_file.txt - - - or simething like that.
Then, you can open a browser and navigate to that url, which will download the PAC-file for you to read as JavaScript.
I have 2 parts to my question. First is just a general question and second is more into app development and coding.
How does Starbucks/Coffee Bean/McDonalds pushes out notification whenever we as customers connect to their WIFI AP? They will push out notifications like "Sign In to proceed using the internet" in the status bar, and then redirects us to their website before we can start using the internet.
I am trying to create an app that does just that by creating a personal hotspot(that will have internet access), and whenever customers are logged into my hotspot, they will receive that same notification. My intention is to just direct them to a 'sign in' page in their browser, and once they click sign in, they will again be directed to my personal website. After that, they are free to surf any websites they want to.
So is it possible to do just that? I only want the app to be installed in my phone, and not in my customers phone.
I'm deducing a lot of this, but I don't see how else it could work.
The wifi hotspots you are referring to are themselves little web servers, in addition to being participants in the world wide web. When a browser sends a URL out, it eventually gets to a web server (we won't go into the DNS system here), and the web server -- a machine listening on one or two ports, ready to accept a URL via socket and return something in response -- responds to it.
In the case you're talking about, the little wifi web server stores the URL sent and, regardless of what it is, sends back the "login to continue" page, and ensures that it is responded to. Once it is, then it does its normal thing with the original URL, which in this case means it sends it out to the internet cloud for interpretation like a normal wifi hotspot would.
As future URLs are sent, the wifi hotspot ensures that the login has occurred -- perhaps it just uses the URL of the machine as a key to information about when it logged in last, or a cookie, there are a couple of ways -- and if there is a current login session, then it again passes the URL out to the internet cloud.
In order to do this in Java on your phone, you would need control of the socket input/output of the hotspot; you would have to be able to read the input, determine whether the login had occurred, and only then either pass along the incoming URL or store it so the login could take place. I don't know how you would do that.
What you describe is a "captive portal" - all new users connecting through the hotspot will have their HTTP requests redirected to this portal. Once you register, your IP-address is known and the redirect no longer occurs.
How this works on mobile devices is typically that when you connect to a hotspot your phone will try to access a well known address and when the redirection occurs to a HTTP-AUTH response it will then open the captive portal as part of the setup process. For instance in the case of the iPhone apple will try to access 'phobos.apple.com' which is why you'll often see this in the pop-up when you are trying to access a "other" website on an non-authenticated access point.
As regards doing this in Java, I think you will have a few problems on your hands. Typically Java only provides network access at TCP/UDP layers and above. Now what you could do is have your application acting as a "proxy" such that it relays all network activity through it, but this would be a heavy load for your application. It also would not have the transparency of the type of solutions you would be used to. Your users may also have to be told to access your site directly.
Your typical captive portal has a few different actors involved and a number of different protocols beneath the application layer. The Access Point needs to "know" whether a user is authorised or not (and thus is redirected to the portal, or gets to access the wider internet); The portal needs to be able to notify the portal upon authentication; 802.1x is used for the initial handshaking; DHCP to assign the IP-address based on MAC address.
This is my situation:
I have a website stored in my mobile, I'm using "kws" to make my mobile as server, ofcourse when i turn on the hotspot in the mobile.
When an user will connect to my hotspot he will type unique ip and port and then enter to my website.
In my website there is place to leave details (email,phone number, name, etc..).
I actually want to take this details and send it to the java android program that is manages the website (i built android app to this mobile that manage the site, she switch the hotspot on/off ,etc..).
In the java code I want to get the details and write them to file or write them to my sqlite database in order to send it to specific email when i will be able to connect to the internet (when i connect to internet i turn off hotspot and the site isn't active anymore.)
The browsers it needs to support are: Internet Explorer, Chrome, Firefox.
How can i do it? don't forgett that the only connection i have is the hotspot in the mobile.
OK, so to solve that i used Websockets. Now i can pass data from javascript to java.
I used this: Writing a WebSocket Server.
I need to make a connection to an Access Database. In order to do that I created a System DSN. I had success making that connection using local files.
However, the database must be at a remote server and I mapped a network drive so I can access the database files. Mapping the drive and using the remote files, an error arises when I try to access the database:
"[Microsoft][ODBC Microsoft Access Driver] Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
"
If I use the database files in the local machine, the error doesn't appear. But accessing the file from the network drive, the exception is throw. Do you know why it happens?
Thanks....
This will sound odd, but add your AD domain to your Trusted Sites in your internet options.
So if your computer is a member of ad.mycompany.com, use that.
I had something similar happen with two people trying to open up the same MDB on a network drive.
I found the problem.
The application invoking my code is a windows service that is running under the SYSTEM account. This account doesn't have permissions to access files outside the server.
A system administrator will create a special account and I need to use it as the service log on account.