I am working on an Android Application in which I got stuck in an issue. The problem is that, "When I run this method mentioned below in code, I am getting an error of socket Exception ((Permission denied) i.e, java.net.SocketException: socket failed:). I tried many time to resolve this issue, but still getting experiencing this problem. I know this is an android developer forum community where I am seeking some solution. Please help me for resolving my query. Here is code please check and reply me asap.
public void run() {
// TODO Auto-generated method stub
URL url = null;
try {
url = new URL("http url");
}
catch (MalformedURLException me) {
// TODO Auto-generated catch block
me.printStackTrace();
}
try {
URLConnection uelCon = url.openConnection();
InputStreamReader inputStreamReader = new InputStreamReader(BufferedInputStream(myconn.getInputStream()));
BufferedReader buffer = new BufferedReader(inputStreamReader);
String traverse;
StringBuilder builder = new StringBuilder();
while ((traverse=buffer.readLine()) != null)
{
builder.append(traverse);
}
}
catch (IOException ioe) {
// TODO Auto-generated catch block
ioe.printStackTrace();
}
super.run();
}
1 Replies
Which permissions do you have set in your manifest? Internet perm is required.