开发者

Android app running on emulator Sync to app on localhost?

I am implementing C2DM (possibly not relevant) in an android app testing on an emulator. I have just got the C2DM registration working with the C2DM service so now I need to register my app with my web app,

As my web app is in dev mode (Rails METAL server) it is running on http://localhost:3020

I need to know if this is reachable from the emulator as I'm not getting anything through to the web app when the registration ID is received in response to the Google C2DM registration process by the andropid app and I'm struggling to work out if I have an issue with my code or if this is because localhost is not reachable.

Thanks in advance for any information on this

UPDATE I found out from http://developer.android.com/guide/developing/devices/emulator.html#networkaddresses that 10.0.2.2 will r开发者_运维知识库oute to 127.0.0.1 but not sure how that would help me get to http://localhost:3020

I'm using a global variable for this

public static final String SERVER_BASE_URL = "http://localhost:3000";

Any ideas what I should set this to?


Try SERVER_BASE_URL = "http://10.0.2.2:3020"; as 10.0.2.2 is going to be "your host loopback interface (i.e., 127.0.0.1 on your development machine)" as per the link you posted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜