0

i`m using standard API (not REST API), and when i backup files and then restore, it works.... problems occurs when i re-install application. After re-install, files in AppFolder are not seen by app, but exists

Query query = new Query.Builder().addFilter(Filters.eq(SearchableField.TITLE, Tags.DB_DATA)).addFilter(Filters.eq(SearchableField.TRASHED, false)).build();
        Drive.DriveApi.query(GAPI, query).setResultCallback(new ResultCallback<DriveApi.MetadataBufferResult>() {
            @Override
            public void onResult(@NonNull DriveApi.MetadataBufferResult result) {
                loadBackups(result.getMetadataBuffer());
                result.release();
            }
        });

this is code so far (inside loadBackups im creating ArrayList with HashMap with details, nothing special), but i have tried listChildren and queryChildren, but same...

at certain point, it can be seen, but i did not catch when it happens, but i know for sure that after re-install, it can not be seen

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
Prophet
  • 53
  • 2
  • 12
  • Possibly related [post](http://stackoverflow.com/q/24916490/4625829). Have you seen it before? – AL. Mar 01 '17 at 11:03
  • thanks, answers seem interesting, im surprised i did not found this... i`ll try and result back – Prophet Mar 01 '17 at 16:35

2 Answers2

0

Not enough rep to comment. However, I suspect that the issue you are having is that by design the last install of an app that a user has removes the app folder from Drive.

So your solution needs to be to back up to a place that is not owned by the app.

I've had a further issue on multiple installs where if you install the app on a second device, it takes "some time" (not sure how long) for Drive to propagate the app folder to the Drive. I have used this to sync data between devices but it is in the hands of Drive when the sync might work its way around.

Ian Spencer
  • 546
  • 3
  • 8
  • 1
    no, i have checked and after uninstalling, app folder stays. now 7 hours passed and backup occured when i created another backup – Prophet Mar 01 '17 at 05:28
0

try to put these line of code onConnected method,

try {
                        Drive.DriveApi.requestSync(mGoogleApiClient)
                                .setResultCallback(syncCallBack);
                    } catch (IllegalStateException ex) {

                    }

And then

private ResultCallback<Status> syncCallBack = new ResultCallback<Status>() {
    @Override
    public void onResult(@NonNull Status status) {
        if (!status.isSuccess()) {
            if (DriveStatusCodes.DRIVE_RATE_LIMIT_EXCEEDED == status.getStatusCode()) {
            }
        }
        Query query = new Query.Builder()
                .addFilter(Filters.contains(SearchableField.TITLE, "abc.txt"))
                .build();
        Drive.DriveApi.query(mGoogleApiClient, query)
                .setResultCallback(metadataCallback);
    }
};
Rabindra Acharya
  • 1,868
  • 2
  • 18
  • 32