Uriel
Uriel

Reputation: 1385

Why can't connect my Android REST client to my REST service?

I have a java REST service which works fine, I'm trying to access to it through an Android client, but the connection is never made. This is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ipn.escom.clientRest.activity"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="com.mx.ipn.escom.clientRest.activity.ClientRestActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

This is my client class that is trying to access my service TemaClient. This is my logcat output LogCat, I don't understand why the connection is never made.

My REST service is in a Windows XP computer and the IP address I'm using to access to it is the one that ipconfig shows me, if I put that same IP on a web browser I get a response, but the Android client never makes the connection. What am I doing wrong?

Upvotes: 1

Views: 1265

Answers (2)

Uriel
Uriel

Reputation: 1385

Fixed this problem, I had to make sure my Android device was connecting to the same network as my REST service.

Upvotes: 0

jeet
jeet

Reputation: 29199

It seams you are accessing network behind a proxy, to use network behind a proxy start emulator by

emulator -avd avdname -http-proxy http://192.168.1.1:8080

I am assuming avdname is avdname and proxy gateway ip is 192.168.1.1

Upvotes: 2

Related Questions