I have a local device (on my wifi network) that can be accessed using a web browser. However, it regularly changes its IP (it is not fixed, and, unfortunately, can't be).
How could I write a java code, for a small android app using a webview, that could scan my network and find the device's IP, quickly and easily ? Connecting to my router everytime this happens is a real pain...
I'm trying to find the X in the following URL : 192.168.1.X:4600/wui
At least, I think the port (4600) and /wui part should help narrowing the search.
Any ideas ? I am completely lost there, this is way above what I can do with android studio.
Thanks ! :-)
Related
I'm using DownloadManager (Android, Java) to download files over WI-Fi from a machine in the same LAN. It works flawlessly on most of the phones I tested, but it appears that on some devices the download just doesn't start when WAN cable (Internet) is unplugged from the router (!). Everything gets back to normal on these phones when I'll connect the Internet cable. Other phones download the files without issues no matter if the Internet is connected to the router or not. This is puzzling me for over a week. There are no clues in logcat (download just doesn't start without any error). It's very odd as the Internet shouldn't have anything to do with the downloads. Everything is happening in the LAN. Any suggestions are welcome.
You can set setAllowedNetworkTypes flag.
refer this -> https://developer.android.com/reference/android/app/DownloadManager.Request.html#setAllowedNetworkTypes(int)
As it finally turned out the Fetch library also introduces the same problem. What worked for me, in this case, was crafting my own downloader with AsyncTask and InputStream.
I have two apps: "app" and "receiver", the latter of which also runs as a service on the phone. These are designed to be run on two separate phones - only one receiver will ever exist, which will be on my phone.
I'll try to make the problem as simple as I can: from the app, I'd like to be able to press a button saying 'hello', which would then load up an activity on the receiver's phone (from the service) also saying 'hello'. Pretty much I just don't know how to get the two devices to talk to each other. This will only be used over the same Wi-Fi connection. Would a broadcast be a suitable way to do this?
I've just started Android development a few days ago so I'm not sure how to do it - it's probably simple - and any help will be massively appreciated!
Many thanks!
Would a broadcast be a suitable way to do this?
No. Broadcasts can be used for inter-app communication, not inter-device communication.
Instead, devices on the same LAN can adress each other using their local IPs (usually 192.168.x.x).
One option would be to open a socket connection, see how to create Socket connection in Android?
I am developing an android application and it requests connecting to a linksys router and i wrote a code on java and it is working but when i tried to transform it to an android application i face a timeout exception in this line
JenNetIPNetwork network = service.createNetwork(new InetSocketAddress("fd04:bd3:80e8:2:215:8d00:32:54ff", 1873));
and i am using an emulator.
So is the problem that i am using an emulator not an android device?
And if there is other solutions any suggestions ?
There is possibly 2 problems.
1) your immolator is not connected with router (its your computer.) so try to connect immolator to router or use real device.(this problem has major chance to generate this bug.)
&
2) All networking related stuff in android must be in other thread. try that out.
Try this hope your problem would be solve by this.
one more thing you have to add internet connectivity permission in xml.(if not then do as well)
I am using MizuTech webphone when i run it using WAMP server of and other server it says cannot find java applet handler..!.
But if i connect my internet it works fine.
Can you please tell is it necessary for Java applet to use Internet ?
If not could you please tell me how I can get rid from it.
You can definitely run an applet without being connected to the internet.
... as long as all of its jars and code are available locally.
While it may be possible to load the applet from local sources, my understanding of SIP calls is that they generally go via the internet. So the main point of a 'SIP phone applet' is lost when there is no internet connection. It is a like a mobile phone with no signal, or a land-line phone when 'the storm has brought down the phone lines'.
I'm trying to instantiate an URL object (in Java) with the address: http://www.cornellrams.com/rss.php. It gives me an UnknownHostException. The site is live and well, but I can't access the feed. Any ideas why it doesn't like me? This is on Android. I do have the internet permission in the manifest.
May be firewall is blocking network connection for the emulator. You need to set /allow emulator to use network connection and also set network connection sharing.
Double check the url ... chances are there's a typo in it somewhere. If not then DNS issue, but you can access the web browser ... so unlikely if you can browse.
Ensure you are using the correct protocol i.e http/https depending on whether you are using ssl
I often get issues with the wifi on my samsung gadgets. not sure what it is perhaps a request gets stuck so I'm forced to turn wifi off then back on again ... it happens a lot (especially with twitter app).
Also make sure that your timeout's are generous especially if using 3g rather than wifi.
I faced same problem once with my emulator. Restarting the emulator helped (maybe also with cleaning build).