Search code examples
androidxml-parsingxmlhttprequestandroid-networkingcellular-network

Receive XML file is corrupted (on sprint network)?


I am having a very strange issue in my Android app. I receive XML file from server and perform operation based on XML content.

It is working on almost every network for e.g. AT&T, Verizon in USA, airtel, Vodafone, and others in India. But it not working on sprint network USA.

When I tried to find XML content I am getting some byte code or unicode not the plain XML file. I looked for more information I found other also has faced this issue on sprint evdeo. People says turn off byte mobile optimization.

I am not able to turn off mobile byte optimization. If I switch to Wi-Fi network it receive file properly. Issue occur on sprint cellular network only.


Solution

  • Thanks everybody for responding my queries i have resolved it few days back.

    Actually sprint compress any xml file using gzip encoding. I tried to unzip the Http response using following it worked like charm. Most of the network provide compress audio/video data but sprint is doing for all data sent across the network.

    I use following code which resolved my issue.

    HttpEntity httpEntity = reponseData.getEntity();
    InputStream res = AndroidHttpClient.getUngzippedContent(httpEntity);
    linputSourceFromServerResponse = new InputSource(res);
    Document doc = builder.parse(linputSourceFromServerResponse);