how to create push notification in Android using GCM or either C2DM i have tried and check some sites and didn't get exact answer.i need to know how it works.Can any one provide me good tutorial on push notification
Could anybody help me. Thanks!!
Its Depend on your requirement what you have to do.
here is sample of C2DM: in this sample android device is registered wtih server after that server send massage to all device. so there is one way communication(server to Android device)
So all things are done at server side. just download this tutorial. Both Server side(PHP) and Android code are available.
Edited:
you got application key from Google services which you have to put at server side.
SENDER_ID – Google project id which you have to send when you want to register your device with server.
You can use GCM demo app supported by Google. One needs to install GCM libs using SDK manager and then create API keys in Google APIs console. Follow instructions from the link and you can create an app that receives push notifications from GCM server. I did try this and it worked even on my Android emulators. You need to use Emulator that targets Google APIs though.
Related
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 have developed web based application using yii2 framework and MySQL database and my plan is i want to make an android app that can receive notification from my web based application real time and can pull data from it too. but i'm not sure how can make it works and using which methods i can implement this. can you give me some advise and source to learn it?
thanks
You have to follow below steps to implement push notification
1) You have to register on google developer consol
https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passive=true&continue=https://console.developers.google.com/dcredirect/
2)enable the GCM api from api list that available in api lists further instruction you will get on site when you create account.
3)Generate key for GCM web/ android.
4) Use this GCM key from android app and write the the GCM notification receiver
program in android app and using notification manager show on notification bar.
5)Using server side key you can write the program to push notification from web site.
Hi android developers,
Today I have decided to use Push notification of GCM. But getting stuck with creating key.
Steps I followed below steps provided in docs
Created project.
under API & Auth Google Cloud Messaging for android turned ON
Here I stuck, which key to choose. In docs it clearly says to select server key but in api key help doc says:
A.Create and use a server key if your application runs on a server.
B. Create and use an Android key if your application runs on Android devices.
My Question is I have developed an offline app which runs on android phone. So which key should I prefer? Also if anyone has done this push notification stuff then please share whole procedure in simple words.It will be great help.
Please help!
Thanks in advance.
you just have to create the public server key and shared it with your api developer which will used it for send push notification with using the Google Cloud Messaging.
I would like to develop a small application which can send notifications or communicate from one phone to another over the internet.
Could any please suggest me how can I start with this project?
Look for Google Cloud Messaging: http://developer.android.com/google/gcm/index.html
There's considerable setup. You need to activate GCM for your app in the developer panel, get yourself an API key, and depending on use case, maybe you'll need an XMPP server as well.
How can I send data from a server to an Android device without the device polling for data?
This is called a server side 'push' and is commonly referred to as 'pushing'. This is a well known feature of the iPhone, however, it does not currently exist on the Android. Android Cloud 2 Device messaging has not yet been released to the general development community. you may want to check out projects such as MQTT and Deacon.
You might consider using Googles cloud to device messaging for a solution.
You'll have to sign up for an account and are only able to use AppEngine servers at the moment.
Your application has to use API level 8 (2.2) in order to be able to receive the cloud's pushes.
GCM (Google Cloud Messaging) is the easiest way, and while GCM provides the basic service of sending messages, there are companies out there that do help you get up and running.
You could take a look at companies like urban airship, xtify and mBlox (developer.mblox.com) to get started with this and have a few additional tools that help you structure the push notifications in a more structured way.
Good Luck with your development!