简体   繁体   中英

Data Sync Between Desktop-Mobile via USB in Cordova/Ionic Application

I am creating a hybrid mobile application using Cordova/Ionic/Angular Js. My requirement is to Sync the Data (or in other words prefill the mobile DB ) from the Desktop(where the Mysql DB is residing) with the SQLite Db (residing in the phone) when i connect the phone to the desktop through USB. I can't use Web Services since the app has to run in an offline mode.

I have done a lot of searching for that but all i could is the solution for Android app(native) where they are mentioning to use JDBC /Socket Programming. I have found one cordova content sync plugin but i think it again requires the internet connectivity , is there any cordova plugin that can help in that? Please guide.

Who should perform the sync? The mobile device or the desktop computer?

I would suggest the following:

  • Enable USB Debugging in Android
  • Desktop computer should have adb drivers installed.
  • Use adb commands to communicate with your device (ie pull the database, perform some updates, push the database)

There is a tool on github which does something similar, maybe you can look at the source to get and idea how to do this: https://github.com/google/adb-sync

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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