I get no errors but my code is not saving any new data to the text file, here is my code:
public void saveToLeaderboard() throws IOException {
String toSave = "Random info I want to save";
HttpConnection connection = null;
connection = (HttpConnection) Connector.open("EXTERNAL URL", Connector.READ_WRITE, true);
connection.setRequestMethod(HttpConnection.POST);
DataOutputStream out = new DataOutputStream(connection.openDataOutputStream());
out.writeUTF(toSave);
out.flush();
connection.close();
}
What am I doing wrong?
My own solution at the end of the day :
I created a server side file (in my case it was a .Net file [.aspx]), I set my external url to call my .Net page with url variables that holds my data needed.
And did a basic save to txt file with server code (in my case C#).
public void saveToLeaderboard() throws IOException {
String toSave = "Data to save";
InputStream inputStream = null;
HttpConnection connection = (HttpConnection) Connector.open("External Url" + "?info=" + toSave, Connector.READ_WRITE, true);
connection.setRequestMethod(HttpConnection.POST);
inputStream = connection.openInputStream();
inputStream.close();
connection.close();
}