Google drive pdf viewer no longer works on Android

I have an android application that could display a PDF file in a web view. A PDF file is hosted on the network, and one of my requirements was not to download the PDF files locally.

Until a few days ago I was able to fulfill all the requirements using the URL

https://docs.google.com/gview/viewer?embed=true&url=<pdf_url> 

Now Google has changed this URL. The new URL is as follows:

 https://drive.google.com/viewerng/viewer?embedded=true&url=<pdf_url> 

With the new viewer, Android no longer displays PDFs. Instead, every time I try to load a PDF file in the viewer, both the emulator and the devices show the following image:

Problem while loading the pdf

How can I solve this problem?

Thanks,

Rik

+6
source share
2 answers

So far I have used a workaround: I load the pdf file into external memory and run the application to display it using the intent.

I always replace the old pdf with a new one, every time the user wants to download a new pdf. Thus, I do not have to worry about the physical space in SD, and the requirement not to download the PDF is partially partially met locally, since only one PDF file can be stored at any time.

I hope that Google will solve the driver problem as soon as possible.

0
source

I think this problem is caused by the fact that this goole drive is https and your URL is http. I tested some pdf address and found this rule

0
source

Source: https://habr.com/ru/post/978197/


All Articles