简体   繁体   中英

Google Cloud Messaging local testing on an external device

I'm trying to implement Google Cloud Messaging for my app in development. I'm following the walkthrough located in the readme a this github repository (the official Google sample project). I'm doing everything that's asked, but I'm confused as to how to test this. As far as I know I have the backend running from my computer (I can connect to the backend from localhost:8080 in chrome), but I want to test device registration with an external device (Samsung Galaxy S4). I realize that the device cannot try to connect to 10.0.2.2 because that makes the device think it's connecting to localhost on the phone itself. I tried entering my computer's IP address with both ports 8080 and 80, but the request times out before anything happens. I'm fairly certain I have the correct Server API Key and Sender ID.

Is there anything which might be wrong here? How can I connect to my computer from the phone? I'm willing to post code and/or error logs if needed. Running LinuxMint 17.2 x64.

如果您在同一网络上,只需键入计算机的内部IP地址,然后键入端口号,即可在手机的浏览器中对其进行测试

Fro GCm Testing you not require to do more thing only get your device token and get you project Auth API key from google developer console test using some tool like , https://gcm.codeplex.com/

and you can copy your device token using edittext,textview or other thing,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM