I am using this example to get some data from a link to an Android device:
The app works fine when using the emulator (Nexus 5 with Android Kit Kat), but when I deploy it (release version) on an actual Android (Samsung S3 mini with Jellybean) the app starts, but crashes after that with "Unfortunately .. has stopped working". If I don't use WebRequest.Create, all my other components in the app work everywhere.
WebRequest request = WebRequest.Create(
"MY LINK HERE"); //with a real link ofcourse
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd()
I fixed the ussue. I didn't know that I had to set permission to use internet.
Project->Project Options->Build->Android Application->Required permission-> Tick the Internet checkbox and press OK.