Hello i have this code that its supposed to update values in mysql, but the OutputStream ops is making my app crash. I have it run in AsyncTask but still makes error.
try {
URL url = new URL(connstring);
HttpURLConnection http = (HttpURLConnection) url.openConnection();
http.setRequestMethod("POST");
http.setDoInput(true);
http.setDoOutput(true);
OutputStream ops = http.getOutputStream(); //error occurs here
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(http.getOutputStream(), "UTF-8"));
data = URLEncoder.encode("visible", "UTF-8") + "=" + URLEncoder.encode(visible, "UTF-8")
+ "&&" + URLEncoder.encode("visible", "UTF-8") + "=" + URLEncoder.encode(option, "UTF-8");
writer.write(data);
writer.flush();
writer.close();
ops.close();
} catch (MalformedURLException ex) {
result = ex.getMessage();
} catch (IOException e) {
result = e.getMessage();
}
This is the error i get:
java.lang.SecurityException: Permission denied (missing INTERNET permission?)