Google Cloud Messaging IP address - android

I have made an android application with GCM enabled service in it which works on localhost. User needs to register in order save the device id in the database which would help administrator to send push notifications to the user. Since, the database is on localhost, registration works fine on emulator. But after installing the app on phone, the device does not get registered. Due to unsuccessful registration, the details do not get entered into the database. After searching a bit, found out the problem as the ip address. IP address on pc is different than the address taken by phone even via same router. Is there any solution for this problem? I really need to run the app on the phone and not just on emulator. Thanks in advance!

Related

Find out ip of server android app is using

So, i am testing my app, it saves data of accounts to a server, and i am wondering if it is possible to get server ip by just having app instaled.
Is there some methods?
Of course. You can get the IP just by checking the router and seeing where requests were made to, you don't even need to run the app- just someone on the network needs to. IP addresses aren't secret.

How to host an android application without using localhost

I've developed an android application that uses a SQL database which is running successfully on localhost. Now I want to give a demo of my application that a user could run remotely. I need to send the apk to another person. I can access the app because I am on the localhost, but how can the remote person access it?
For android app your app hosting best solution is Andorid Firebase and this service is Free.
Firebase Hosting Referance
It's also work like a web app so another person can view the demo as you required.
Firebase also provide Storage, Database and so on feature that you should be like.
Thanks.
You only have to tell the other person to use the internet address of your router.
Then on your router forward the used port to the ip address of the pc where your service runs.
Please dont talk about localhost the way you do. Every device is its own localhost. So also your Android device is a localhost. And every pc is.

How to run an offline DNS Server on Android?

Let me explain the situation:
I am using my android phone as WiFi hotspot that gives a code (that user can reedem on my shop) when he has completed a registration.
I need to use my phone because I do this on the beach and the only way to to this is having something portable.
Okay, so:
I have used this tecnique so far and everithing gone well, i have set up a webserver on my phone and using some iptables i redirected all the traffic to my captive portal when a user tries to surf the net.
It worked like this:
USER asked my phone: "Hey what's the IP for google.com?"
MY PHONE connected to DNS and received the correct IP.
IPTABLES manipulated this IP to send to USER the local ip of my captive portal.
But there's a big problem: i need mobile data on!! And on the beach many times i do not have signal and when a user connect to my hotspot, it gives DNS error instead of my captive portal.
The only solution is to run an offline DNS server that doesn't require internet to hijack all the request to the captive portal.
I use BitWebServer as ligthhttpd server and i looked for DNS Server to run my DNS offline but i am really confused and i don't know where to start.
Someone of you have and idea? I just need to redirect all the request that comes from USER connected to my hotspot to the captive portal WITHOUT using internet.
Thanks in advice, regards
Giorgio

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.
if you are on same network , just type the internal ip address of the computer followed by port number , you can test it in the browser itself in phone
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,

failed gcm registration in android

I'm trying to deploy an application with push notifications. The problem is that I can not get it to work from a device. While using the emulator, everything is ok but when using a cell phone I get a log saying "AUTHENTICATION_FAILED".
I have checked and the Gmail account is synchronized but is always trying to check me out this error.
Could someone give me a hand?
This is occurred due to the bad Google Account password. Check your account on the phone.
Bad Google Account password. The Android application should ask the
user to enter his/her Google Account password, and let the user retry
manually later. Fix on the device side.
Check error codes and explanations here.
The problem was that I had multiple accounts on the phone, for those who have the same problem only has to synchronize with an initial account set up the phone.
In my case I face this problem due to a firewall on the network which blocked URLs and ports of GCM. I solve it temporarily by using a VPN service i.e. Hotspot.
To solve permanently I allowed following ports and URLs on firewall.
5228
5229
5230
All IPs which are listed in Google's ASN of 15169

Categories

Resources