I am trying to implement android push notification by using GCM. But, in all the tutorials that I have referred so far, I get one or more PHP files. Is it not possible without PHP, because I don't know PHP. Any help will be appreciated.
I f you want to implement GCM you'll need a mediator file php/.net etc which acts as communicator between your server and the GCM server.This file pass the message to be delivered along with the projectid(registered with google console)to GCM server.So that GCM server can send push messages to all mobile devices regisytered under the corrosponding projectid.You can use this based on your purpose.
You don't have to have PHP for GCM, you can use any server side language i.e. Java (J2EE), Python, etc. But what you must have is a server.
See what android is saying about GCM here
A full GCM implementation requires both a client implementation and a
server implementation. For more information about implementing the
server side, see Implementing GCM Server.
Some similar questions:
GCM java server example
How to send notification to Android app from Java server using GCM?
Related
I need to work with android push notifications. I have an app that works with a local database. When this DB is modified i want to send a notification to many concrete person.
I was looking at GCM and Firebase. But i dont know if those ways permit me to do this.
I dont understand good the firebase documentation. If my server side is develope in android and my client side is also in android. I only need to register in FCM service the client side project and then i use the API key that FCM provides me, in the server side with de userID to send notifications?
I know how to implement GCM in my App but I don't know how to build a server able to send notification to ALL the users.
I need something quite simple (just sending notification), could you advise me any services and tutorial in order to set up the server?
I wish something not to complex, because everything that I will need from my app is receiving whether simply notifications to display or to tell the app that some new data is available for downloading.
Thank you!!
Prerequisite for GCM Application
Google API Server Key
GCM RegId of the Android Device to communicate via GCM
If you get clear concept about GCM, please visit here
If you want to use java for server side then visit my answer.
Related Links:
Android Push Notifications using Google Cloud Messaging (GCM), PHP and MySQL
Android Warriors
If you're using PHP, you could use this approach to send GCM message to your client refer this
You could setup your own local server on PHP using AMPP. refer this
Probably, the simplest way is to add a cloud endpoint module refer this. Then, write a simple service refer this that sends the messages. Finally, let Android Studio deploy it.
I am buiding an android app which will be receiving notifications from my server. This means all my users which is above 1 million, will receive notifications from my server. I know parse and google cloud messaging(GCM) can do the push messages but please I want to know the best out of this two (parse and GCM) so I can implement it. Thanks in advance.
If you look at https://parse.com/tutorials/android-push-notifications you can see:
The Parse library provides push notifications by using Google Cloud Messaging (GCM).
So you have to register your app to GCM console to send push notification in anyway.
When to NOT use parse.com?
If you already have a backend service, you can easily implement push notification since there are plenty of third part libraries for different platforms such as node.js, php etc.
When to use parse.com?
If you don't have backend-service and you just want to send push notifications also if you don't want to spend your time by setting up server stuff then you can go with parse.com
NOTE: Facebook shuts down parse by January 2017 so please consider it.(http://blog.parse.com/announcements/moving-on/)
Android push notification is a service used to send messages directly to the Android Mobile Devices.
There are several ways we can implement Android push notification.
Google Cloud Messaging(GCM)
Parse Notification(Parse.com)
You are asking which one is the best way to implement :
The standard way is using GCM (Google Cloud Messaging) but there are some alternatives like Parse Notification,Which is easier to use.
If you need to handle Json Push messages,Refer this link
Steps involved in send Push notifications:
Developing the application involves two parts:
GCM Server Application – Create Web application using Php to send message to User via GCM Cloud server
GCM Client Application – Create Android application which receive message sent from GCM Server Web App
For More Informations regarding to GCM server and Client Application
Parse uses GCM and uses own service for Kindle
Please Go with google cloud messaging(GCM) .It is very easy to integrate in android app. the problem with parse in some case device token or registration id is not register at their database so User of parse does not get push notification.In case of GCM we can sure for device token
So my recommendation is GCM
Hope this will help you.
I need example GCM in android with ASP .Net service. Can You share example about it?
Check Push notification on Androïd
Server can use GCM registration ID sent by device to communicate with Google Cloud Server.
See here:
Google Cloud Messaging Server Side Code in C#
It's a simple HTTP POST where you need to pass in the correct set of parameters (JSON data and your APK and a registration key from what I remember). By using the libraries in the above link, or simply writing your own, you should be able to post messages to GCM and then have your Android client react to the messages that are posted by your service.
I am creating a chat application on android using GCM. I'm already able do receive messages from the cloud and to send them manually through a PHP script using cURL. I can simple make an HTTPRequest to this script everytime a user send a message but I would like to know if there's a way to remove this script thus making the android app directly send the message to the cloud. If this is possible I also would like to know if it is the "right" way to do it or if the HTTPRequest is as good as it.
Thanks in advance.
Not really. GCM is not meant to replace your entire infrastructure, just the push channel from your servers to the clients.
That said, there is this concept of Upstream Messaging (from device to Google's servers) but Google's servers then contact your servers (via XMPP of all things) to let you decide what to do next.
You cannot do device-to-device over GCM.