Search code examples
androidlaravel-5android-networkingandroid-ion

Android Ion GET Request - Unknown uri scheme


I am developing an API locally using Laravel 5. I have been trying to get an android app I'm also working on to digest a very basic bit of test JSON.

I'm using the Android networking library Ion and my code is as follows:

 Ion.with(this)
            .load("192.168.0.65:8000/test")
            .asJsonObject()
            .setCallback(new FutureCallback<JsonObject>() {
                @Override
                public void onCompleted(Exception e, JsonObject result) {

                    if (result != null) {
                        Log.e("ION", "Somethings been returned");
                    } else {
                        Log.e("ION", "Nothing was returned");
                        Log.e("ION ERROR", e.toString());
                    }
                }
            });
}

I can access the JSON correctly via the browser on the phone @ 192.168.0.65:8000 but the previous code throws the following error:

ERROR﹕ java.lang.Exception: Unknown uri scheme

I've done alot of googling around the issue but couldn't find anything that related to a similar situation.

Am I missing something / if this is not URI scheme android will allow is there a way I can bypass it. I really would like to continue to develop the API locally.

Thanks


Solution

  • Try "http://192.168.0.65:8000/test" the scheme is the "http" part which is missing from your URL.