I need to make a shared folder in android. I want to be able to:
1) create a folder on the device(sdcard/SharedFolder). ; 2) create a folder on the server. ; 3) copy some files to that folder. ; 4) seamlessly synchronize those files with my Android(and vice-versa). ;
The idea is to make an ftp connection to the ftp server(local filzila server at first) and compare my local files list to his remote files list(by means of comparing timestamps or any other way). Then my application would decide which files are the most updated and will copy them(from device to server or from the server to the device).
So i have 3 issues which i wanted to talk about:
I.Currently i made my application be a Broadcast-Receiver which is being called by the Alarm-Manager repeatedly(with the inexact method) and run on its own process. Upon receiving a broadcast i connect to the server and make the above. currently the broadcast-receiver is set from some Activity(enable/disable buttons and thats it.)
What will happen to my Broadcast-Receiver after killing the Activity which set him? I understood that at some point the system will delete him from the Alarm-Manager too? How should i handle this? I want the program to run without the user handling it... hence after restart of the device and etc i don't want him to re-enable my program.
II. How would you suggest to handle the files compare between the folders? i would like to support copy, delete, edit on those files hence the most suitable version of a file should be on both the server and device after the sync. i thought about making some manifest file in each folder and save in it data on the file like: -who change it las开发者_运维技巧t and when -how much readers does this file have(can it be done as a service of the phone? some event of opening a file or a folder?) and etc.
III. Any suggestions will be appreciated!
ADB provides a shell interface where you can issue commands shell commands. See http://developer.android.com/guide/developing/tools/adb.html#shellcommands
You can also use the sync command provided with ADB. Open a prompt and issue 'adb help' to see more.
精彩评论