Android和PC通信通过USB:是什么,我可以用ADB推/从一个Android应用程序拉和访问安全的目录? [英] Android and PC Communication over USB: What is a safe directory that I can use ADB push/pull on and access from an Android app?

查看:419
本文介绍了Android和PC通信通过USB:是什么,我可以用ADB推/从一个Android应用程序拉和访问安全的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个应用程序,将允许计算机在Android手机和Java应用程序通过USB数据线进行通信。使用蓝牙或无线上网的是不是在这种情况下,一个选择

I am writing an application that will allow an android phone and java application on the computer to communicate over the USB cable. Using Bluetooth or Wifi is not an option in this case.

我发现它很难找到一个很好的解决这个问题,主机/附件libariries似乎旨在挂钩手机达码头/摄像机/ circuitbo​​ards,而不是简单的PC。这是我的解决方案,让我知道,如果有更好的选择:

I found it very difficult to find a nice solution to this problem, and the Host/Accessory libariries seemed designed to hook the phone up to docks/cameras/circuitboards rather than simply a PC. This is my solution, let me know if there are better alternatives:

我要创建一个Java应用程序中使用亚行推动文件到手机,手机将检查这些文件的修改和采取相应的行动。

I'm going to create a Java application to use ADB to push files onto the phone, the phone will then check those files for changes and act accordingly.

这似乎运作良好,到目前为止,除了我现在用的是/ SD卡/文件夹来保存这些文件。我想这个应用程序的工作就手机没有SD卡了,所以我想知道如果有,我可以能够从PC与亚洲开发银行和Android应用程序访问,以及算上其他一些安全的文件夹。

It seems to work well so far, except I am using the /sdcard/ folder to hold these files. I want this app to work on phones without SD cards too, so I want to know if there is some other safe folder that I can count on being able to access from the PC with ADB and the android app as well.

(我看过的内部存储库,但我不知道他们在哪里存储数据,如果我可以把/亚行拉他们。)

(I have looked at INTERNAL STORAGE libraries, but I don't know where they store their data and if I can push/pull with them from ADB.)

在此先感谢您的帮助!

推荐答案

阅读本的 https://groups.google.com/forum/?fromgroups#!topic/android-developers/tZrxqZQLh98 关于召开tmp文件,尼斯的讨论。 做ü要控制从PC的应用程序?不能使用由亚洲开发银行为推出意图?

Read this https://groups.google.com/forum/?fromgroups#!topic/android-developers/tZrxqZQLh98 Nice discussion about holding tmp files. Do u want to control your application from PC? Cant you use Intents launched by ADB for that?

另外通过USB与亚行选项端口转发: 亚洲开发银行将TCP:6100 TCP:7100 adb中转发TCP:6100地方:logd

Another options port forwarding over USB with ADB: adb forward tcp:6100 tcp:7100 adb forward tcp:6100 local:logd

我个人最终做了GET请求,以我的本地Apache服务器获取数据。 或者对根设备多文件夹可用。

Personally I end-up doing GET requests to my local Apache server to fetch data. Or on rooted device many folders become available.

这篇关于Android和PC通信通过USB:是什么,我可以用ADB推/从一个Android应用程序拉和访问安全的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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