android - 是否可以在 google 文档请求中包含 http header ?

标签 android http header request

我正在开发一个需要读取远程 pdf 文件并打开它的 Adnroid 应用程序,我看到 google docs 可以使用此 url 从 pdf 进行转换:

http://docs.google.com/viewer?url=

我遇到的问题是我检索文件的 url 需要将 header 添加到 http 请求。有没有人知道如何将其添加到对 google docs 的调用中?

最佳答案

我没有完全理解你的问题,但这是我在 webview 中加载 pdf 所做的同样的事情:Android - Load PDF / PDF Viewer , 它可能对您有所帮助。

根据您在下面的评论,我可以建议您考虑一种情况:

1. 
 if(network is available)
    {
   //    load pdf in google docs.
    } 
2. 

if(network is not available)
{
 //load pdf in third party application which is already been installed in your phone.
}
else 
{
//Give Alert message that you cant view pdf this time. or whatever message you want to display.

}

给出错误信息

关于android - 是否可以在 google 文档请求中包含 http header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5664514/

相关文章:

json - REST API 最佳实践 : args in query string vs in request body

internet-explorer - 使用 307 重定向 IE 中的发布请求

python - 如何自动拉伸(stretch) QTableView 列并保持它们可调整

c++ - 命名空间、类和编译器顺序

java - 在 SugarORM 中将对象作为参数传递

java - 如何在 Android 上创建可滚动的弹出窗口?

android - Android 中的作业管理器

android - 在 Android 中将任意元数据写入 EXIF

ruby - 使用 Ruby 将 HTTP GET 的响应主体流式传输到 HTTP POST

c# - 向简单 Web 服务请求添加 header