Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

HttpWebRequest support on Android

Discussion in 'Android' started by cjk136, Sep 18, 2014.

  1. cjk136

    cjk136

    Joined:
    Sep 18, 2014
    Posts:
    2
    Hi,

    I am trying to use HttpWebRequest in Android game. But it seems HttpWebRequest cannot work on Android device. I test it on Unity 4.5 and Samsung Galaxy Nexus (Android version 4.3).

    string response = null;
    HttpWebRequestrequest = (HttpWebRequest)HttpWebRequest.Create("http://www.yahoo.com");
    request.Method = "GET";
    using (StreamReaderreader = newStreamReader(request.GetResponse().GetResponseStream()))
    {
    response = reader.ReadToEnd();
    }


    response is always null.

    Can anyone one help verify that HttpWebRequest is supported or not on Unity ?

    Thanks
     
  2. Trungdv

    Trungdv

    Joined:
    Dec 1, 2012
    Posts:
    22
    I have the same issue.
    In PlayerSettings, I changed "Stripping Level" from "Strip Byte Code" to "Disable", then the issue has been fixed.
    Hope this will help.