Reputation: 11
completely newby in Android, coming from c# world.. I've written a little private app for android and that must not be available on play store and the like... the app is using JTDS to directly connect to local SQL Server to manage "inputs" from the device, and it works as expected :)
again, the app can not be updated via play store, but now I'd like to provide a feature to update it [occasionally it will :)] so I'd like to verify on a local network share a text file containing the latest build available and, eventually, copying the "new" apk to android \Download directory... but I still have to find a way to "read\connect" the the LAN's share... I've seen other threads like How to use httpget in my app and basically my code follows How to get file via HttpGet from pc in local network on android
but the code "fails" with 404 status code... in the HttpGet(file) I've provided the LAN location of the file I need to read, like String file = "http://192.168.x.xxx/NetworkShare/file2read.txt";
the share is on a Windows7 machine with readonly permissions and no authentication required... It's not a Windows Domain, it's just a WorkGroup so permissions troubles should be excluded... I'm still checking with the emulator and not the physical devices... the manifest already includes Internet permissions, WIFI_STATE, NETWORK_STATE If helps, I'm using Android Studio 1.1.0
any hint or alternative?
asql
Upvotes: 0
Views: 4253
Reputation: 263
What you try to do with HttpGet won't work with a Lan location because when you share a directory you are using SMB,CIFS or NFS protocol and it's impossible to access those files via HTTP. If you want to use HttpGet you must publish your files through a HTTP server.
I think there is no way to mount a drive programmatically in Android. It is possible with busybox but maybe you need to be root.
The best way to do what you want is getting the information from a webservice or maybe downloading your file from a ftp server.
Upvotes: 1