简体   繁体   中英

how to send push notifications to multiple users via php

I am following this tutorial from androidhive. http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

Everything is working But The tutorial only shows how to send a push to ONE device at a time. I would like to send a push notification to all devices at once using the same method. I believe the way to do this is by editing the send_message.php But i'm still trying to understand how his method works.

I have tried commenting and emailing the person who wrote the article but have not gotten a response. I just need someone to point me in the right direction.

Any hints, guildance, answers, comments are much appreciated.

Now that you have successfully implemented what that tutorial teaches, the basis idea now for sending to multiple users will be something like this:

To send push notification to multiple users, you need to create an application server in PHP.Your application server will receive the registration id from the android application and will store it in a database (may be mysql).

Now when you want to send the message to the application then you write a message and fetch all the registration ids from the database which was stored earlier.

You can follow this useful tutorial to achieve exactly what you want.

The tutorial which you have mentioned was made using GCMRegistrar which is deprecated now.Instead you need to use GoogleCloudMessaging API .The link which i provided uses the new way.Hope this helps you to implement what you want.

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