0
I am developing an APP, where it needs to get data online via Json from an API, without making any changes it stopped working while it was working normally, I have tested on the server that this normal.
In 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 return of the server:
{
   status: "sucess",
   id: "28937"
}
In my manifest I’ve 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, only suddenly stopped picking up and began to say that the android APP stopped.
Error in Java:
org.json.jsonexception end of input at character 1 of
Have you made any changes to the server or even the file?
– Samuel Ives
No, I think I am the server since there is no error with the code or with the Json itself.
– Anderson Amorim