我正在开发一个需要读取远程 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/