first let me describe the logic.
User turn on Photos Upload button to launch a transfer service to upload local photos to server.
When the app was left invisible to user. still monitor the local photos, if camera new photos, upload it immediately. I use this ContentResolver resolution to implement the function.
after terminate the app, user may take new photos, when restart the app, scan the local sd-card and upload those new photo.
Here is my question:
When should I put step2
into Service in case the activity was destroied. should I use another service to implement the step3
business.
you can find the source on Github
see the source snippet below:
Intent txIntent = new Intent(this, TransferService.class);
startService(txIntent);
Log.d(DEBUG_TAG, "start TransferService");
// bind transfer service
Intent bIntent = new Intent(this, TransferService.class);
bindService(bIntent, mConnection, Context.BIND_AUTO_CREATE);
Log.d(DEBUG_TAG, "try bind TransferService");
Intent monitorIntent = new Intent(this, FileMonitorService.class);
startService(monitorIntent);
Intent cameraUploadIntent = new Intent(this, CameraUploadService.class);
startService(cameraUploadIntent);
this.getApplicationContext().getContentResolver().registerContentObserver(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, false, cameraUploadObserver);
`
So should I put cameraUploadObserver in service?