可以编写从Windows应用程序文件,直接到Android的SD卡? [英] Possible to write files from Windows application directly to Android SD card?

查看:175
本文介绍了可以编写从Windows应用程序文件,直接到Android的SD卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一种方式来编写Windows应用程序的文件到Android设备的SD卡通过USB连接。要做到这一点,我将需要获得SD卡的驱动器号,它的安装点。我的Windows应用程序是用C ++,所以我最希望能在C解决方案++。如果不可能,或许有一个Java溶液然后可以被放置在一个C ++包装由我的应用程序的code被调用。

I'm looking for a way to write a file from a Windows application to an Android device SD card over a USB connection. To do this, I will need to obtain the drive letter of the SD card, and it's mount point. My Windows application is written in C++, so I'm most hoping for a solution in C++. If not possible, perhaps there is a Java solution which can then be placed in a C++ wrapper to be called by my application's code.

我已搜索周围,并提出了一些想法,但似乎没有任何工作呢。首先,我碰到谷歌的文档,来了一个方法,Environment.getExternalStorageDirectory(),但我的假设是,因为这是Android SDK的一部分,它是从驻留在Android设备上的应用程序只能使用。其次,我在Windows的原生API(WINBASE.H为主),它提供了查找所有驱动器及其相应的信件的方式遇到了一些功能,但即使我能得到这个信息,我不知道如何确定哪些这些是连接的Andr​​oid设备的SD卡。

I've searched around and come up with a few ideas but nothing seems to work yet. First, I came across Google's documentation on a method,Environment.getExternalStorageDirectory(), but my assumption is that since this is part of the Android SDK, it is only usable from an application residing on an Android device. Secondly, I came across some functions in Windows' native API (WinBase.h primarily), which provides a way of locating all drives and their corresponding letters, but even if I can get this information, I don't know how to determine which of these is the connected Android device's SD card.

任何帮助是AP preciated!

Any help is appreciated!

推荐答案

我不是一个Windows应用程序专家,但如果你能使用的系统在C ++调用程序中调用adb.exe,那么你就可以直接执行ADB命令设备

I'm not a windows application expert but if you can use system calls in your C++ program to call adb.exe, then you can execute adb commands directly to the device.

例如,如果你可以执行adb.exe设备就可以得到当前连接到计算机的所有Android设备的列表。从那里,你可以使用任何亚行命令将文件推到设备上。

For example if you can execute "adb.exe devices" you can get a list of all android devices currently attached to the computer. From there, you can use any adb commands to push files onto the device.

在这里的亚行命令的详细信息: ADB维基

More information on the adb commands here: ADB wiki

您正在寻找的可能是在做组合的 ADB设备 ADB推&LT是什么,你的文件> / SD卡/<对文件的SD卡>

What you're looking for is probably doing an adb devices in combination with adb push <your file> /sdcard/<file on sdcard>

祝你好运!

这篇关于可以编写从Windows应用程序文件,直接到Android的SD卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆