Télécharger un fichier data:application

Fermé
Romaingrst Messages postés 2 Date d'inscription vendredi 5 février 2021 Statut Membre Dernière intervention 5 février 2021 - 5 févr. 2021 à 11:51
Romaingrst Messages postés 2 Date d'inscription vendredi 5 février 2021 Statut Membre Dernière intervention 5 février 2021 - 5 févr. 2021 à 15:40
Bonjour,

Je voudrais télécharger un fichier data:application qui est générer en javascript depuis une webview. Sauf que le downloadmanager ne prend que les URL et non les URI . Je viens donc vers vous pour avoir une solution à mon problème.

Merci !
A voir également:

1 réponse

BunoCS Messages postés 15495 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 octobre 2024 3 909
5 févr. 2021 à 14:39
Hello,

As-tu essayé de convertir ton URI en URl ?
URL myURL = new URL(uri.toString());

0
Romaingrst Messages postés 2 Date d'inscription vendredi 5 février 2021 Statut Membre Dernière intervention 5 février 2021
Modifié le 5 févr. 2021 à 15:40
Merci de ta réponse .

Et non ca ne fonctionne pas il me dit qu'il ne peut pas la convertir en string.

Ah voici l'erreur que j'ai sans la convertir :

2021-02-05 15:28:10.360 15656-15656/com.example.var E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.var, PID: 15656
2021-02-05 15:28:10.360 15656-15656/com.example.var E/AndroidRuntime: java.lang.IllegalArgumentException: Can only download HTTP/HTTPS URIs: data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,UEsDBAoAAAAAAIV7RVIAAAAAAAAAAAAAAAAJAAAAZG9jUHJvcHMvUEsDBAoAAAAIAIV7RVL7/6sLMwEAAGkCAAARAAAAZG9jUHJvcHMvY29yZS54bWylkl1LwzAUhu8F/0PJfZumczJD24HKQHQg2KF4F5KzLdh8kES7/Xvbbus23J2XyfucJ+cckk83qo5+wHlpdIFIkqIINDdC6lWBFtUsnqDIB6YFq42GAm3Bo2l5fZVzS7lx8OqMBRck+Kg1aU+5LdA6BEsx9nwNivmkJXQbLo1TLLRHt8KW8S+2Apyl6S1WEJhggeFOGNvBiPZKwQel/XZ1Lx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AAGIHAAB4bC93b3Jrc2hlZXRzL19yZWxzL1BLAQIUAAoAAAAIAIV7RVIO23ur/QEAAMAFAAAYAAAAAAAAAAAAAAAAAJQHAAB4bC93b3Jrc2hlZXRzL3NoZWV0MS54bWxQSwECFAAKAAAACACFe0VS6x7Kw9oBAAAkBAAADQAAAAAAAAAAAAAAAADHCQAAeGwvc3R5bGVzLnhtbFBLAQIUAAoAAAAIAIV7RVIiF+dSqwAAAPIAAAAUAAAAAAAAAAAAAAAAAMwLAAB4bC9zaGFyZWRTdHJpbmdzLnhtbFBLAQIUAAoAAAAIAIV7RVLeB6t2RQEAACUEAAATAAAAAAAAAAAAAAAAAKkMAABbQ29udGVudF9UeXBlc10ueG1sUEsFBgAAAAAPAA8AkAMAAB8OAAAAAA==
at android.app.DownloadManager$Request.<init>(DownloadManager.java:468)
at com.example.var.MainActivity$1.onDownloadStart(MainActivity.java:66)
at Cs.handleMessage(chromium-TrichromeWebViewGoogle.apk-stable-410410681:156)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
0