开发者

Writing a file in Android accessible by PCs on the LAN

开发者 https://www.devze.com 2023-02-23 00:54 出处:网络
My android app needs to write a file to a location that can be accessed by windows pc on the same LAN running XBMC. I need to use a built in XBMC function that launches a slideshow when it receives a

My android app needs to write a file to a location that can be accessed by windows pc on the same LAN running XBMC. I need to use a built in XBMC function that launches a slideshow when it receives a path or url to a playlist file.

As far as I can see, my options are to:

1) Write the file to the android device's SD card, make that location public, then pass a url string to the PC.

I don't know how to make an SD card file accessible via url.

2) Write that file directly to the PC, then pass a file path string to the PC

I don't know how to write to a PC's hard drive from an android开发者_运维知识库 app.

I've tried running NanoHttpD webserver on my android device, but it fails to initialise, I've also tried setting up an FTP server on the PC but I've not managed to successfully interface with it from android.

Solution 1 appeals most to me as it will require no changes to the XBMC PC.

Can someone suggest a way to make a file on an android device accessible via a url, or how to write to a PC from an android device?

Any alternative approaches/technology suggestions welcomed.

Thank you


To write files to the PC you may be able to get an SMB client library for Android. There's an app that claims to do this https://market.android.com/details?id=com.shank.SambaExplorer , I have no idea if it can give access to another app on the same handset. In any case it's open source so maybe you can incorporate it.

If you can run a server on the PC it might be simple to write a socket-based service and use sockets on Android http://developer.android.com/reference/java/net/Socket.html


Can you try an ftp server? There's an open source one here:

http://code.google.com/p/swiftp/

http://www.appbrain.com/app/swiftp-ftp-server/org.swiftp

"SwiFTP is unmaintained and up for adoption"

0

精彩评论

暂无评论...
验证码 换一张
取 消