tliebeck
tliebeck

Reputation: 836

Issue previewing Google Docs text documents using embed URL on Android Phones with Documents List API v3.0

I'm attempting to provide previews of Google Docs text documents in a WebView on Android. I'm using the Google Documents List API v3.0, from which I am receiving an link element containing an embed URL, e.g.:

<link rel="http://schemas.google.com/docs/2007#embed" type="text/html" href="https://docs.google.com/document/d/XXXXXXXXXXXXXX/preview"/>

To preview the document, I create a WebView and configure it to provide the appropriate authorization credentials on requests. I then direct the WebView to the provided embed URL, and the result is illustrated in the screenshot below.

Instead of previewing the document as desired, a mobile view is displayed. Unfortunately this mobile view is a bit dysfunctional, as the user interface controls provided will simply display 401 Unauthorized errors when tapped.

Is there any means by which I can display the document and hide the extraneous user interface controls?

I've tried specifying a desktop user agent for the WebView. This does solve this problem, but creates another in that the document is displayed very zoomed out and the browser's zoom controls are ineffective at correcting it (I actually need to try a few more things on this front, but it's looking grim).

My preference would be for a mobile view without the UI chrome.

Any suggestions are greatly appreciated!

Screenshot from Android Phone

Upvotes: 1

Views: 1158

Answers (1)

Ali Afshar
Ali Afshar

Reputation: 41663

For a read-only solution, you could export the document as HTML using the Documents List API, and display that to the user.

Upvotes: 2

Related Questions