We are having an issue getting dashboard and visua...
# gooddata-cloud
a
We are having an issue getting dashboard and visualization exports working on a webview of a Good Data dashboard embedded in an android app. The URL contains is a full screen iframe of the embedded dashboard. It seems that we are not able to authenticate into the blob that is returned after tapping to export. We are roughly following the method described here to attempt to download the it: https://stackoverflow.com/questions/72181133/how-to-download-blob-url-in-webview Specifically, we have a download listener on the android webview listening for a URL that looks something like this: blob:https://abc-app.cloud.gooddata.com/7fbff1... then makes a XMLHttpRequest() GET request via a javascript interface. Then the console returns the following error:
[INFO:CONSOLE(1)] "Not allowed to load local resource: blob:https://...
Exports via the same URL work fine on mobile chrome and safari. We are unable to find any information in your docs for how to get this working. Please advise.
m
Hello Adam, I am not an Android developer expert, but from my research so far, I've found that Android Webview does not automatically support file downloads via blob URL's. Blob URLs are generated within the browser’s memory and require special handling to be downloaded, especially in WebView, which does not natively handle Blob URL downloads in the same way that a full browser (like Chrome) does. Please note that this use case falls within the custom implementation scope for which we do not have a "one size fits all" example, hence the apparent lack of information in our docs. However, I found the following thread that may provide some hints as to how to handle this: https://stackoverflow.com/questions/10069050/download-file-inside-webview
a
@Moises Morales Thanks for replying. Unfortunately that stack overflow link doesn't contain anything we don't already know. The root issue seems to be how to authenticate into the blob.
m
Could you please provide a snippet of how exactly you're handling the webview? Feel free to send it via DM if it's more comfortable to you.
a
Sent it to you via DM
r
Hi there Adam, Radek from the GoodData Technical Support team here! Just wanted to let you know I'm checking into this and hoping to have more pointers for you soon 🙂
1
Hi Adam, apologies for the delay! I went over this, and discussed the issue with our frontend developers as well - unfortunately, we don't really have that much experience with Android dev between us, plus using blobs is actually something that the devs did to avoid authentication issues. I did get a summary of what worked for the devs, I hope this contains useful pointers for you; I'm afraid that we won't be able to really help much more than this. 🤞
The gist of the changes is that there was issue to send Bearer auth header with GET to export endpoint URL returned by the last successful polling request, and these requests ended unauthenticated. The download mechanism worked by creating <a> element pointing to returned URL and then simulating the click event on it. I found out that mentioned successful polling request returns export data in the response already so it is not necessary to call the GET export again. The returned data are converted to blob and blob URL is used to stream the data when download is triggered. The blob URL is local and does not need additional authentication. The blob URL is used in the attached <a> element to trigger the download.
👀 1