0

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.

3
  • It looks like the PHP code in the link you provided already supports sending the same message to multiple registration IDs. You just have to pass to the send_notification function multiple registration IDs. Commented Sep 7, 2014 at 21:26
  • do you mean like an array? Commented Sep 7, 2014 at 21:54
  • Yes, that's what I mean. Commented Sep 7, 2014 at 22:00

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

your suggested tutorial was very clear. Best use stuff thats not deprecated. Thanks for the assist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.