0

I have a schedule set at 3 AM everyday for backup. During this time, it takes a local backup followed by a cloud backup to Google Drive. My question is:

If internet is not available at 3 AM, cloud backup will not take place. So if there is always no internet at 3 AM, cloud backup will NEVER take place.

Is there any workaround for this??

Zubin Kadva
  • 593
  • 1
  • 4
  • 29

2 Answers2

1

It looks like Completion Events can help with your implementation.

Failure - This status indicates that the action associated with this event has permanently failed to be applied to the server. The content or metadata that failed to be applied to the server can be retrieved using the CompletionEvent's getModifiedContentsInputStream or getModifiedMetadataChangeSet, allowing you to try to apply them to the server at a later time.

Since you are scheduling an upload, you can check for Failures through the EventService and then just implement your code to retry the upload on intervals of your choice.

SwagBomb
  • 584
  • 3
  • 7
  • Thanks a lot @SwagBomb. Could you also help me out with this SO ticket: http://stackoverflow.com/questions/36327532/android-get-driveid-for-restore. Thanks. – Zubin Kadva Mar 31 '16 at 14:43
0

I took an alternate approach. I defined a receiver in AndroidManifest.xml as:

<receiver android:name="com.xyz.abc.Receiver"
    android:exported="false"
    android:process=":remote" >
    <intent-filter>
        <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
    </intent-filter>
</receiver>

This will trigger whenever there is a change is network connectivity. Then in onReceive() if a backup is required, I start my upload process. This way, I save on unnecessary bandwidth consumption.

Thanks for your help everyone!

Zubin Kadva
  • 593
  • 1
  • 4
  • 29