Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied error while call webservice using HTTP in android application

Tags:

android

I'm working in android application. I create a web service in Java. Now i want to refer a web service using HTTP. But i got Permission Denied error while the debugger reached the last line. The Code is:

HttpClient httpClient = new DefaultHttpClient(); 
HttpContext localContext = new BasicHttpContext(); 
HttpGet httpGet = new HttpGet("http://192.168.0.102:8282/SampleWebProj/services/Converter"); 
response = httpClient.execute(httpGet, localContext); 

Plz Give me a solution..

like image 674
Siju Avatar asked Oct 14 '10 10:10

Siju


People also ask

Why is it showing permission denied?

A "Permission denied" error means that the server rejected your connection.

How to check if a permission is granted Android?

To check if the user has already granted your app a particular permission, pass that permission into the ContextCompat. checkSelfPermission() method. This method returns either PERMISSION_GRANTED or PERMISSION_DENIED , depending on whether your app has the permission.


2 Answers

In your code, you put

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

instead of

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

you misspelled android -> anroid != android ;-)

like image 187
Alpha Avatar answered Oct 28 '22 09:10

Alpha


Have you added the correct permissions on AndroidManifest.xml to open http connections?

I think, you have to add this permission

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
like image 4
brent Avatar answered Oct 28 '22 11:10

brent