cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android HttpConnection empty response

i have a custom API based project... i have a php script with returns data in json form but it works well on my localhost. On godaddy it returns empty response to HttpConnection on java android. I checked it works well when i open same link on browser. 

1 REPLY 1

Re: Android HttpConnection empty response

Have you enabled internet connections in your android manifest file? That is where I would start. 

<uses-permission android:name="android.permission.INTERNET" />

There should be a line like that in your apps manifest file. Otherwise, the app wont be able to make http requests. The fact that it loads on the browser, tells me thew API is working just fine. The only thing on the server you could configure is the headers. You can configure the CORS setting(cross orrigin requests) in the headers, you want to make sure you are allowing the requests to either come from your app, or a wildcard to allow requests from any other server/domain