In this tutorial i give the instruction from the previous post Android Push Notifications using Google Cloud Messaging (GCM), PHP and MySQL Part - 1 if you are new to this please go through my previous post.
Now lets start the coding from the PART - 1
Now lets start the coding from the PART - 1
5. Create another file named GCM.php This file used to send push notification requests to GCM server.
<?php class GCM { //put your code here // constructor function __construct() { } /** * Sending Push Notification */ public function send_notification( $registatoin_ids , $message ) { // include config include_once './config.php' ; // Set POST variables $fields = array ( 'registration_ids' => $registatoin_ids , 'data' => $message , ); $headers = array ( 'Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json' ); // Open connection |