Is it possible to include http headers in a google docs request?
I am working on an Adnroid app that needs to read a remote pdf file and open it, I saw that google docs can do the conversion from pdf, using this url:
http://docs.google.com/viewer?url=
The problem I have is that my url to retrieve the file requires a header to be added to the http request. Does anyone have a hint as to how this could be added to the call to google docs? 开发者_高级运维
I didnt get your problem exactly what you means to say , but here is the same thing i have done to load pdf inside a webview: Android - Load PDF / PDF Viewer, it may help you.
From your comment below, i can suggest you to think one scenario:
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.
}
Give error message
The secret is HttpClient.
Check out this example on cookies - it's different from headers, but the same object can be used to set them both. It's a pretty good chunk of code.
Google around, if you've got more questions - once you know what to use, I found it easy to look up the specifics I needed.
精彩评论