I did the android client side for FCM, I tested it using FCM console.
Now I need to setup a server which gets the registrationId from client using Http link and also sends push notifications. This is the first time I am setting up a server.
Related
I want to stay connection on web server using php by android app.by java coding
suppose when get any new input from webserver (by url php) android app make a Toast with the input and run the app on background service how I do it.
thanks
simple way is use websocket ,
1. webserver should enable websocket , create a websocket endpoint
2. android app connect the websocket endpoint
3. webserver can push msg to app by endpoint
4. then android receive msg
you can reference these page:
https://github.com/codebutler/android-websockets
http://socketo.me/
I have a java client that reads and writes to a local postegresql database. The application receives SMS messages from Twilio through a webhook. Right now I use spark in the client and utilize ngrok to create a URL of localhost that twilio can use as the webhook. How can I scale this to production? I would like to keep the webhook as part of the client, so I can receive messages in real time instead of periodically requesting the messages from a web server.
Is this possible?
I'm aware of GCM services for push notifications, but I have this issue.
I have a android app which will send a data to a local web server (php) that will response to another android device with the data sent, a normal push notification with GCM, I think.
But I need this to work even without internet, because it is a local web app that will work only that.
Is that even possible? Android device X send json data to web server that will send the data to other android device Y.
How can I verify that exists new data in the device Y ?
Thanks. I know its a little wierd.
Yes, it is possible. But it is not easy to develop. This is why:
Push notifications work attached to an account service. So you would have to implement an Authenticator service and then the whole push platform yourself.
I would not use GCM for what you are doing though. If it is working on a local network, you can use "polling" (request the server every now and then for updates)
I am currently working on a project which requires a server to request data from the devices which are currently connected to the server. Meaning, first the server finds out which devices are connected to the server and then sends an application specific message to the client device which should wake certain functionality present on the client.
I was looking into XMPP service which looked promising since it works as a PUSH notification. The in XMPP can be used to check if the device is currently connected and has subscribed to the server. Since every android user has a gmail account, I was thinking of using the gmail xmpp service to connect /subscribe to the server. Then send specific message to the client, i.e x...#gmail.com.
However if a message is sent this way the client app gets the message as well as the native gtalk client. So how do I go about intercepting this so that it doesn't show up on the gtalk client but my app still gets it ?
Use the full JID when sending the message. The send to multiple clients should only occur when the bare JID is used.
Full JID -> xyz#gmail.com/device
Bare JID -> xyz#gmail.com
My question is how does the Google Cloud Messaging know where to send the message to? does it work by IP Address? Is there an interval that runs a function on the phone to send the current location or IP Address of the phone to the Google server? Does anyone know?
Google doesn't need to know the IP address of your device. Instead, your device connects to Google, identifies itself using whatever protocol Google uses for authentication, and Google then uses that established connection to send notifications to your device.
When your phone changes from one IP address to another, it simply makes a new connection to Google, and Google then uses that new connection for your notifications. Google wouldn't even need to keep track of your IP address after you disconnect, since as soon as you disconnect (like on a public wifi system), somebody else might start using that same address.
Here is the link which explains the working of GCM http://developer.android.com/guide/google/gcm/gcm.html
Every GCM client creates a unique device token that you need to send to GCM server for sending the push notifications to client.
Here you can find link explaining the GCM.
GCM Works by Running a Service of its Own to handle Push Notifications.
This service requests the Google Cloud Server (GCM) with your app token ID created by GCM for any pending notifications created by your app and sends the response back with all the notifications from your token id to your app, and this happens for the all the apps using GCM.
So, basically if you have 5 apps which have implemented GCM then their token IDs will be send together by this service and GCM will check if any notification is available for the sent token id's and send them as a response.
Read this thread, this guy has explained it, and GCM is reliable for new app builds !!
http://eladnava.com/google-cloud-messaging-extremely-unreliable/