无法访问谷歌驱动器文件 [英] Cannot access Google Drive file
问题描述
我使用谷歌驱动器
制作一个记事本应用程序。每当用户创建的应用程序文件,它也创造了文件谷歌驱动器
。而且用户可以输入文字并保存文件时,未保存的文本将得到承诺只要网络连接。我使用的管理更新和创建进程的应用程序中的 DriveId
。
I am making a notepad app using Google Drive
. Whenever user creates a file in the app, it also creates a file in the Google Drive
. And user can enter the text and save the file, the unsaved text will get committed whenever the internet is available. I am managing the update and create processes within the app using the DriveId
.
如果用户想使用我的应用程序使用的替代设备中的文件,对于我也有叫选项 DriveId进口
。通过点击选项 DriveId进口
用户将被提示进入现有的 DriveId
输入框。使用 DriveId
我想打开的文件,但它给了一个错误。
If the user wants to use the files with the alternative device using my app, for that I also have the option called DriveId import
. By clicking the option DriveId import
user will be prompted with the input box for entering the existing DriveId
. Using the DriveId
I thought of opening the files, But it was giving an error.
然后,我看到了在这个<给定答案href="http://stackoverflow.com/questions/29030110/cannot-get-folderid-that-i-just-created-on-google-drive?answertab=active#tab-top">SO其中明确表示, DriveId
只能用于内部应用程序和设备而创建的文件。
Then I saw an answer given in this SO which clearly says DriveId
can be used only inside the app and device which created the file.
我还发现,像我这样一个类似的问题在这里<一href="http://stackoverflow.com/questions/29050204/cannot-access-google-drive-from-2-different-device/29055166">SO但我不能让我的问题解决了。使用 result.getDriveFolder()我已经采取RESOURCEID。getDriveId()。getResourceId()
I also found a similar question like mine in here SO But I can’t get my problem solved. I have taken ResourceId using result.getDriveFolder().getDriveId().getResourceId()
如何读取数据的编程方式使用的ResourceID?正如上面的回答<一说href="http://stackoverflow.com/questions/29050204/cannot-access-google-drive-from-2-different-device/29055166">here我不想改变轨道,进入驱动器REST API
。 有没有办法,我可以通过读取数据的方式谷歌驱动器的Android API
?我已经做了所有的开发过程中,但在结尾的时候我试着从它给错误其它设备访问。完全来袭。
How to read the data’s programmatically using the ResourceID? As said in the above answer here I don’t want to change the track and go into Drive REST API
. Is there a way that I can read the data using Google Drive Android API
? I have done all the development process, but in the ending when I try to access from other device it is giving the error. Totally struck.
如果我只能通过读取数据 REST API
任何简单的code将AP preciated。提前致谢。
If I can only read the data using REST API
any simple code will be appreciated. Thanks in advance.
推荐答案
终于解决了DriveId问题没有REST API。
要获得 DriveId
的替代设备。您将需要RESOURCEID。您可以使用下面code: -
To get DriveId
on the alternative device. You will need resourceId. You can use following code:-
String resourseId = "xxxxxxxxxxxxx"
Drive.DriveApi.fetchDriveId(mGoogleApiClient,resourseId).setResultCallback(idCallBack);
private ResultCallBack<DriveApi.DriveResult> idCallBack = new ResultCallback<DriveApi.DriveIdResult>() {
@Override
public void onResult(DriveApi.DriveIdResult driveIdResult) {
msg.Log("onResult");
DriveId id = driveIdResult.getDriveId(); //Here you go :)
}
}
这篇关于无法访问谷歌驱动器文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!