Thanks for the reply and the workaround.
I can't use that workaround though because the file I'm downloading is the
cache.manifest that needs to be interpreted by Crosswalk.
I'll try to find a workaround on the server side while the problem persists.

Best regards,
Décio Macedo

On 16 July 2015 at 07:49, Zhang, Belem <[email protected]> wrote:

>  Hi Décio,
>
>
>
> Thank you for the reporting! Currently the setUserAgentString() API can
> only effect xwalk loading, the downloading will keep using default system
> user agent, the new bug XWALK-4625 has been reported, please track it.
>
>
>
> https://crosswalk-project.org/jira/browse/XWALK-4625  Embedding API
> setUserAgentString can't affect xwalk downloading
>
>
>
> If you need a  temporary workaround,  please try to add
> request.addRequestHeader("User-Agent", yourCustomUserAgent)  as follows:
>
>
>
>          xwalkview.setDownloadListener(new
> XWalkDownloadListener(getApplicationContext()) {
>
>                    @Override
>
>                    public void onDownloadStart(String url, String
> userAgent,
>
>                                             String contentDisposition,
> String mimetype, long contentLength) {
>
>                             Uri src = Uri.parse(url);
>
>                             if (src.getScheme().equals("http") ||
> src.getScheme().equals("https")) {
>
>                                      Request request = new Request(src);
>
>
> request.addRequestHeader("User-Agent", yourCustomUserAgent);
>
>
> request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,
> fileName);
>
>                                      DownloadManager downloadManager =
>
>
> (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE);
>
>                                      downloadManager.enqueue(request);
>
>                             }
>
>                    }
>
>          })
>
>
>
> BR
> Belem
>
>
>
> *From:* Crosswalk-help [mailto:
> [email protected]] *On Behalf Of *Décio
> Macedo
> *Sent:* Thursday, July 16, 2015 3:12 AM
> *To:* [email protected]
> *Subject:* [Crosswalk-help] Custom User Agent problem
>
>
>
> Hi,
>
> I've been using Crosswalk Webview with a custom user agent, it works fine
> most of the time except when it downloads the cache.manifest file.
> When I call loadurl(), Crosswalk will use the custom user agent to get the
> index.html but when it downloads the cache.manifest it will use the default
> user agent. For everything else after this it will use the custom user
> agent again.
>
> I need to use the custom user agent to download the cache.manifest because
> this file is being generated according to the user agent.
>
>
> Is there any other way to force it to use the custom user agent all the
> time?
>
> Best regards,
> Décio Macedo
>



-- 

*Décio Macedo **| **Systems Integration Engineer*

Email: [email protected] <[email protected]> | Skype: dcmnonius

Rua Eng.º Frederico Ulrich, 2650 | 4470-605 Moreira da Maia ● Portugal
*T* +351 220301520 | *F* +351 220301521 | *W* www.noniussoftware.com


[image: http://www.facebook.com/noniussoftware]
<http://www.facebook.com/noniussoftware>
<http://www.linkedin.com/company/Nonius>
<https://twitter.com/#!/NoniusSoftware>
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to