Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

issues in classes with latest google play service 21 #27

Closed
achinverma opened this issue Feb 12, 2015 · 11 comments
Closed

issues in classes with latest google play service 21 #27

achinverma opened this issue Feb 12, 2015 · 11 comments

Comments

@achinverma
Copy link

hi i have imported this demo with latest google play service library 21 but i am getting some errors in some classes like
The method newDriveContents(GoogleApiClient) is undefined for the type DriveApi
DriveContents cannot be resolved to a type
DriveContentsResult cannot be resolved to a type

please any one guide me is there any updated demo with latest google play service library 21 ?

@seanpjanson
Copy link

http://stackoverflow.com/questions/28405205/error-com-google-android-gms-drive-driveapi-drivecontentsresult-cannot-be-resolv

On Thu, Feb 12, 2015 at 5:16 AM, achinverma notifications@github.com
wrote:

hi i have imported this demo with latest google play service library 21
but i am getting some errors in some classes like
The method newDriveContents(GoogleApiClient) is undefined for the type
DriveApi
DriveContents cannot be resolved to a type
DriveContentsResult cannot be resolved to a type

please any one guide me is there any updated demo with latest google play
service library 21 ?


Reply to this email directly or view it on GitHub
#27.

@seanpjanson
Copy link

I believe 'com.google.android.gms:play-services:6.5.87' is 'ver 22' in
Android SDK Manager
sean

On Thu, Feb 12, 2015 at 5:19 AM, Sean Janson seanpjanson@gmail.com wrote:

http://stackoverflow.com/questions/28405205/error-com-google-android-gms-drive-driveapi-drivecontentsresult-cannot-be-resolv

On Thu, Feb 12, 2015 at 5:16 AM, achinverma notifications@github.com
wrote:

hi i have imported this demo with latest google play service library 21
but i am getting some errors in some classes like
The method newDriveContents(GoogleApiClient) is undefined for the type
DriveApi
DriveContents cannot be resolved to a type
DriveContentsResult cannot be resolved to a type

please any one guide me is there any updated demo with latest google play
service library 21 ?


Reply to this email directly or view it on GitHub
#27.

@achinverma
Copy link
Author

i am getting these errors in my classes i will post screen shot, actually my requirement is just to create a File with some text in the file and i want to upload this file into drive and later i want to fetch that file and i want to edit the content of the file and upload again,is there one who can guide me?
untitled

@seanpjanson
Copy link

I've slammed together another (hopefully simpler) demo, try that one.
https://github.com/seanpjanson/GDAADemo
But don't shoot me, I'm not with Google, just another poor developer.
sean

On Thu, Feb 12, 2015 at 5:34 AM, achinverma notifications@github.com
wrote:

i am getting these errors in my classes i will post screen shot, actually
my requirement is just to create a File with some text in the file and i
want to upload this file into drive and later i want to fetch that file and
i want to edit the content of the file and upload again,is there one who
can guide me?
[image: untitled]
https://cloud.githubusercontent.com/assets/2811593/6167456/91b3cbec-b2e1-11e4-8cc9-8b4aefdb310b.png


Reply to this email directly or view it on GitHub
#27 (comment)
.

@seanpjanson
Copy link

If you insist on continuing this fight, your problems (from what I see on
the screenshot) are coming from unresolved imports. And in turn these
missing imports may be a result of incorrect library version. So:
1/ pull Rev 22 of GooPlaySvcs lib.
2/ make sure your dependencies are as shown in SO 28405205.
I see you're using Eclipse (OUCH), don't know how to set it up there. I'm
on Android Studio.
sean

On Thu, Feb 12, 2015 at 5:34 AM, achinverma notifications@github.com
wrote:

i am getting these errors in my classes i will post screen shot, actually
my requirement is just to create a File with some text in the file and i
want to upload this file into drive and later i want to fetch that file and
i want to edit the content of the file and upload again,is there one who
can guide me?
[image: untitled]
https://cloud.githubusercontent.com/assets/2811593/6167456/91b3cbec-b2e1-11e4-8cc9-8b4aefdb310b.png


Reply to this email directly or view it on GitHub
#27 (comment)
.

@achinverma
Copy link
Author

yes i am on Eclipse , and not able to import your demo, i have to re create it for eclipse.
i don't know the demo on github for google drive is working with which version of google play library.

@seanpjanson
Copy link

Been there for 3 years (Eclipse) and feel your pain:-).
Anyway, You will probably run into the same import issues, my demo is on
Rev.22 / 6.5.+ as well. The dependencies are here:
https://github.com/seanpjanson/GDAADemo/blob/master/build.gradle.

On the other hand, most of what you need is there. But be careful if you
decide to use GDAA or REST. GDAA may get you in trouble with rather loose
latency issues and lack of delete / trash functionality.
http://stackoverflow.com/questions/21369573/trash-delete-in-new-google-drive-android-api
If you look at SO
http://stackoverflow.com/questions/tagged/google-drive-android-api
you may guess what's in front of you.
sean

@achinverma
Copy link
Author

hi seanpjanson ,
I have done Google drive integration and in integration i have created a file and write some text on the file and save it into the Login user's drive it is running fine but i want to to update the contents of the file i have created a save to drive, i have done allot of research but did not able to find the demo or any code, please any one guide me, i will post my code where i am creating file and saving to my drive
you can check this link http://stackoverflow.com/questions/28622664/android-update-the-file-content-of-created-file-on-google-drive

@seanpjanson
Copy link

I'll look at it. Please add the 'google-drive-android-api' tag in SO, so
It shows in this list:
http://stackoverflow.com/questions/tagged/google-drive-android-api
sean

On Fri, Feb 20, 2015 at 1:19 AM, achinverma notifications@github.com
wrote:

hi seanpjanson ,
I have done Google drive integration and in integration i have created a
file and write some text on the file and save it into the Login user's
drive it is running fine but i want to to update the contents of the file i
have created a save to drive, i have done allot of research but did not
able to find the demo or any code, please any one guide me, i will post my
code where i am creating file and saving to my drive
you can check this link
http://stackoverflow.com/questions/28622664/android-update-the-file-content-of-created-file-on-google-drive


Reply to this email directly or view it on GitHub
#27 (comment)
.

@achinverma
Copy link
Author

ok and i have updated my code on stack-overflow , and i have fetch the contents of the file i have save to drive , now only updating the file contents is pending ..

@achinverma
Copy link
Author

hi @seanpjanson
i have used code to update File contents i will post mu code to update File contents
but i am getting below error ?
Status{statusCode=Failed to retrieve item from network., resolution=null}

Drive.DriveApi.fetchDriveId(getGoogleApiClient(), result.getDriveFile().getDriveId().toString())
.setResultCallback(idCallback);
final ResultCallback idCallback = new ResultCallback() {
@OverRide
public void onResult(DriveIdResult result) {
if (!result.getStatus().isSuccess()) {
Log.e("idCallback result.getStatus()=", ""+result.getStatus().toString());
Toast.makeText(MainActivity.this,result.getStatus().toString() ,Toast.LENGTH_LONG).show();
return;
}
DriveFile file = Drive.DriveApi.getFile(getGoogleApiClient(), result.getDriveId());
Log.e("DriveFile result.getDriveId()=", ""+result.getDriveId());

        new EditContentsAsyncTask(MainActivity.this).execute(file);
    }
};

public class EditContentsAsyncTask extends ApiClientAsyncTask<DriveFile, Void, Boolean> {

    public EditContentsAsyncTask(Context context) {
        super(context);
    }

    @Override
    protected Boolean doInBackgroundConnected(DriveFile... args) {
        DriveFile file = args[0];
        ContentsResult driveContentsResult;
        try {
            driveContentsResult = file.openContents(getGoogleApiClient(), DriveFile.MODE_WRITE_ONLY, null).await();
            if (!driveContentsResult.getStatus().isSuccess()) {
                Toast.makeText(MainActivity.this,driveContentsResult.getStatus().toString() ,Toast.LENGTH_LONG).show();
                return false;
            }
            Contents driveContents = driveContentsResult.getContents();
            OutputStream outputStream = driveContents.getOutputStream();
            outputStream.write("Edit Hello world".getBytes());

            file.commitAndCloseContents(getGoogleApiClient(), driveContents);

            /*outputStream.close();
            driveContents.close();*/
           /*com.google.android.gms.common.api.Status status = driveContents.commit(getGoogleApiClient(), null).await();*/
            Log.e("driveContentsResult.getStatus()", ""+driveContentsResult.getStatus().toString());

            return driveContentsResult.getStatus().isSuccess();

        } catch (IOException e) {
            Log.e("IOException while appending to the output stream", e.toString());
        }
        return false;
    }

    @Override
    protected void onPostExecute(Boolean result) {
        if (!result) {
            //showMessage("Error while editing contents");
         Toast.makeText(MainActivity.this,"Error while editing contents" ,Toast.LENGTH_LONG).show();
            return;
        }
        Toast.makeText(MainActivity.this,"Successfully edited contents" ,Toast.LENGTH_LONG).show();
        //showMessage("Successfully edited contents");
    }
}

@kroikie kroikie closed this as completed Jul 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants