Android-Volley: TimeOutError when trying to connect from a real device
Add below code in your volley request before request.add(string) to change timeout duration.
request.setRetryPolicy(new DefaultRetryPolicy(
5000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
android volley TimeoutError
I hope this will work for you.
While accessing localhost API from real device your device must be in the same network or LAN.
Make sure that have you added internet permission in the manifest.
Set DefaultRetryPolicy
to your request.
objectRequest.setShouldCache(false);
objectRequest.setRetryPolicy(new DefaultRetryPolicy(30000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
Add above code before this requestQueue.add(objectRequest);
line.
Related Topics
How to Update UI from Asynctask
How to Detect App Removed from the Recent List
Google Play Services Out of Date. Requires 11011000 But Found 10289574
Getting Null Device Id While Registering to Gcm
Get Response Status Code Using Retrofit 2.0 and Rxjava
How to Provide Different Android App Icons for Different Gradle Buildtypes
Existing 3-Function Callback to Kotlin Coroutines
Determine Angle of View of Smartphone Camera
Capture Picture Without Preview Using Camera2 API
The Import Android.Support.V7.App Cannot Be Resolved
How to Disable Proguard for Building My Android App
How to Display Map (Google) on a Phonegap Android Application
Call Getlayoutinflater() in Places Not in Activity