Android: how can i browse remote device file system via bluetooth?

前提是你 提交于 2019-12-19 17:35:49

问题


I need to build an Android app that puts/gets files from a remote device via Bluetooth; the app must also browse the remote filesystem. I've read something about OBEX but have really not found any example for Android, except some great apps on the market as Bluetooth File Transfer. How can it be implemented in an app?


回答1:


Since there is no standard method/implementation of OBEX OPP/FTP that is exposed to developers on Android, you will have to roll you own over the Bluetooth API which is powerful enough implement just about any protocol you want as it mirrors TCP sockets.

The first thing you will have to do is get access to the filesystem. Assuming the SD Card, here is a guide otherwise you would need root access. Then you want to get a Bluetooth connection working between two devices (boilerplate code). Lastly you should Google up the protocol specification for OBEX OPP/FTP and implement it which is probably going to take the most time.

I'm pretty sure that's how the other apps on the marketplace do it as they require the app on both devices in order to send/receive files and browse the filesystem. I can't go in depth on the OBEX protocol itself as I'm not familiar with it but I can elaborate on everything before that if needed. However a google search turned up this which may be useful while implementing.

Not sure if this will help but I've seen this to have worked for a lot of people to send files.




回答2:


This is not possible with the built-in Android API. There are intents you can call to share files over Bluetooth - but compatibility between models varies. However, there are some methods if you would like to write an app for rooted phones. If this is the case, please note it.



来源:https://stackoverflow.com/questions/7194039/android-how-can-i-browse-remote-device-file-system-via-bluetooth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!