Android の Google ドライブにファイルをダウンロードしようとしていて、 https://developers.google.com/drive/manage-downloads#examplesのサンプルに従っていました。
if (entry.getDownloadUrl() != null && entry.getDownloadUrl().length() > 0)
{
try
{
LogUtils.xi(this, "start opening url:", entry.getDownloadUrl());
/* HttpRequestFactory: Thread-safe light-weight HTTP request factory layer on top of the HTTP */
HttpResponse resp = manager.getDrive().getRequestFactory()
.buildGetRequest(new GenericUrl(entry.getDownloadUrl()))
.execute();
return resp.getContent();
}
catch (IOException e)
{
LogUtils.xe(this, e.toString());
e.printStackTrace();
throw ExceptionUtils.getIOException("Can't open inputstream.", e);
}
}
else
{
LogUtils.xw(this, "The file doesn't have any content stored on Drive.");
return null;
}
しかし、エラー 302 が表示されます。ここで何が起こっているか知っている人はいますか?
03-29 14:56:07.316 E/XXGoogleDrive(25539): [25566][DriveDLFutureTask] [getInputStream]com.google.api.client.http.HttpResponseException: **302 Moved Temporarily**
03-29 14:56:07.326 W/System.err(25539): com.google.api.client.http.HttpResponseException: 302 Moved Temporarily
03-29 14:56:07.326 W/System.err(25539): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1062)