Can't Read XML File

Hi everyone

I built an android App which download XML file and then read it. The App works fine on IOS devices but when I put it on Android devices seems it can’t read the xml file!!

I tried all of these permissions:
“android.permission-group.STORAGE”,
“android.permission.WRITE_EXTERNAL_STORAGE”,
"android.permission.READ_OWNER_DATA ",
“android.permission.READ_EXTERNAL_STORAGE”,

but still can’t read the file.

** The App can locate the file BUT it can’t read it!!

ANY HELP :slight_smile:
thanx [import]uid: 41548 topic_id: 34436 reply_id: 334436[/import]

It sounds like the server is sending you the file in compressed form. Mac and iOS automatically decompress HTTP responses, but Windows and Android do not.

You can tell the server to not compress the response by setting the “Accept-Encoding” header to an empty string when you call the [lua]network.download()[/lua] function as follows.
[lua]local parameters =
{
headers =
{
– Set to empty string to tell server to send response in uncompressed form.
[“Accept-Encoding”] = “”
},
body = “Your message”,
}
network.download(myUrl, “GET”, onDownload, parameters, “myFile.xml”, system.DocumentsDirectory)[/lua]

Also, none of the Android permissions that you’ve posted are necessary. Your app’s directories are on internal storage and do not require any permissions. [import]uid: 32256 topic_id: 34436 reply_id: 137120[/import]

It sounds like the server is sending you the file in compressed form. Mac and iOS automatically decompress HTTP responses, but Windows and Android do not.

You can tell the server to not compress the response by setting the “Accept-Encoding” header to an empty string when you call the [lua]network.download()[/lua] function as follows.
[lua]local parameters =
{
headers =
{
– Set to empty string to tell server to send response in uncompressed form.
[“Accept-Encoding”] = “”
},
body = “Your message”,
}
network.download(myUrl, “GET”, onDownload, parameters, “myFile.xml”, system.DocumentsDirectory)[/lua]

Also, none of the Android permissions that you’ve posted are necessary. Your app’s directories are on internal storage and do not require any permissions. [import]uid: 32256 topic_id: 34436 reply_id: 137120[/import]

Thank you! I spent hours trying to work out why the file couldn’t be read.

Is there any chance this could be added somewhere on http://docs.coronalabs.com/api/library/network/download.html

I would think xml files are fairly common to download, and it would save other people from having to search the forums for a response (or more likely, ask the question again and again). [import]uid: 84115 topic_id: 34436 reply_id: 142839[/import]

Oh good! I’m glad my forum post helped you out. :slight_smile:

Adding the ability to automatically decompress the received response is on our to-do list, but low priority at the moment. But that said, we’ll soon be introducing a huge “network” API update which will introduce features that people have been wanting for long while now. These network API update has to come out first due to popular demand. Can’t say specifically what it is yet, but stay tuned! You’ll hear something about this in the next 2 weeks! [import]uid: 32256 topic_id: 34436 reply_id: 142919[/import]

Thank you! I spent hours trying to work out why the file couldn’t be read.

Is there any chance this could be added somewhere on http://docs.coronalabs.com/api/library/network/download.html

I would think xml files are fairly common to download, and it would save other people from having to search the forums for a response (or more likely, ask the question again and again). [import]uid: 84115 topic_id: 34436 reply_id: 142839[/import]

Oh good! I’m glad my forum post helped you out. :slight_smile:

Adding the ability to automatically decompress the received response is on our to-do list, but low priority at the moment. But that said, we’ll soon be introducing a huge “network” API update which will introduce features that people have been wanting for long while now. These network API update has to come out first due to popular demand. Can’t say specifically what it is yet, but stay tuned! You’ll hear something about this in the next 2 weeks! [import]uid: 32256 topic_id: 34436 reply_id: 142919[/import]

Thank you! I spent hours trying to work out why the file couldn’t be read.

Is there any chance this could be added somewhere on http://docs.coronalabs.com/api/library/network/download.html

I would think xml files are fairly common to download, and it would save other people from having to search the forums for a response (or more likely, ask the question again and again). [import]uid: 84115 topic_id: 34436 reply_id: 142839[/import]

Oh good! I’m glad my forum post helped you out. :slight_smile:

Adding the ability to automatically decompress the received response is on our to-do list, but low priority at the moment. But that said, we’ll soon be introducing a huge “network” API update which will introduce features that people have been wanting for long while now. These network API update has to come out first due to popular demand. Can’t say specifically what it is yet, but stay tuned! You’ll hear something about this in the next 2 weeks! [import]uid: 32256 topic_id: 34436 reply_id: 142919[/import]

Thank you! I spent hours trying to work out why the file couldn’t be read.

Is there any chance this could be added somewhere on http://docs.coronalabs.com/api/library/network/download.html

I would think xml files are fairly common to download, and it would save other people from having to search the forums for a response (or more likely, ask the question again and again). [import]uid: 84115 topic_id: 34436 reply_id: 142839[/import]

Oh good! I’m glad my forum post helped you out. :slight_smile:

Adding the ability to automatically decompress the received response is on our to-do list, but low priority at the moment. But that said, we’ll soon be introducing a huge “network” API update which will introduce features that people have been wanting for long while now. These network API update has to come out first due to popular demand. Can’t say specifically what it is yet, but stay tuned! You’ll hear something about this in the next 2 weeks! [import]uid: 32256 topic_id: 34436 reply_id: 142919[/import]