简体   繁体   English

连接Android手机时,使Java应用程序同步PC上的联系人

[英]making a Java application synchronize the contacts on the PC, when an android phone is connected to it

I do not know how to start building upon this simple idea : 我不知道如何开始建立这个简单的想法:

When an android phone is connected to a PC, a Java application running on the PC detects the device and starts synchronizing the contacts in the android phone. 将Android手机连接到PC时,PC上运行的Java应用程序会检测到该设备,并开始同步Android手机中的联系人。

Can anyone help me how do I start this ? 谁能帮助我该如何开始? I know how to write applications in Java but have never worked with android OS or have made application for the android operating system. 我知道如何用Java编写应用程序,但从未与android OS一起工作过,也没有为android操作系统编写过应用程序。 That is the reason I am unable to start this.Please tell,if there is anything I need to delve in before I should start. 这就是我无法启动此程序的原因。请告诉我是否有需要深入研究的内容,然后再开始。

The contacts info can only be got in the android apps, so you have to write an android app and a pc app, and transfer data between them. 联系人信息只能在android应用中获取,因此您必须编写android应用和pc应用,并在它们之间传输数据。

  1. When a device is connected to pc, start your pc app automatically. 将设备连接到PC后,将自动启动PC应用程序。
  2. Install your android app to the device. 将您的android应用安装到设备上。

    adb install apk-path

  3. Start the android app. 启动android应用。

    adb shell am start -n pkgname/activityname

  4. Start a tcp connecton. 启动TCP连接。

    adb forward tcp:port tcp:port

    read this page for details. 阅读此页面以获取详细信息。

  5. Try to collect contacts in android app and transfer them to pc. 尝试在Android应用中收集联系人并将其转移到PC。 There are many articles about how to get contacts in android, and the data transmission will use Serialization and Socket programming. 关于如何在android中获取联系人的文章很多,数据传输将使用序列化和套接字编程。

adb (android debug tool) is a android sdk tool, you need to learn more about it. adb(android debug tool)是一个android sdk工具,您需要了解更多有关它的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM