I am developing an APP, where it needs to get data online via Json from an API, without making any changes it stopped working being that it was working normally, I already tested the server that is normal.
No java:
//Consulta na API que retorna o JSON
InputStream input = new URL(Minha_Url_Json).openStream();
Reader reader = new InputStreamReader(input, "UTF-8");
Scanner s = new Scanner(reader);
//Pegando o JSON
String json = s.nextLine();
JSONObject jsonObj = new JSONObject(json); //Transformando o Json em Objeto
//Pegando item especifico do JsonObjeto
String status = jsonObj.getString("status");
String id = jsonObj.getString("id");
The server return:
{
status: "sucess",
id: "28937"
}
In my manifest I already enabled the connection:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
The interesting thing that until yesterday was working normally, just that of nowhere it stopped catching and started saying that the android APP stopped.
Java Error:
org.json.jsonexception end of input at character 1 of