tigerden
tigerden

Reputation: 728

Android Push Notification not being received

I am following the tutorial of GCM given here on AndroidHive. Everything is same except I am using my own Sony Xperia L instead of any emulator. I am able to register my device on my database. However, Google's API console is not showing any change after registration. Here is the screen I am getting before and after registration.API Screen

I am immediately getting a blank notification (with no data or text) on my cell just after registration. But whenever I try type and send a notification from the web interface built during the tutorial, the page gets refreshed without showing any error, but no notification arrives on my cell.

Please help me solve this problem. I want to manage push notifications based on users in my MySQL database. If any similar descriptive tutorial explains the same, it will be very much helpful to me. Thanks :)

Upvotes: 0

Views: 766

Answers (2)

tigerden
tigerden

Reputation: 728

I used my own php script to contact GCM server Instead of the interface index.php given in tutorial.

<?php    
    include_once './GCM.php';

    $gcm = new GCM();

    $registatoin_ids = array("my_reg_id_here");
    $message= "Wow! a noti!";
    $message = array("price" => $message);

    $result = $gcm->send_notification($registatoin_ids, $message);

    echo $result;
?>

Upvotes: 0

Aditya Harsh
Aditya Harsh

Reputation: 386

I also faced the same problem in the beginning but then it was solved. Make sure that your computer from which u are sending the notification and the device are connected to the same wifi. Also if u r using WAMP, make sure that 'PHP Curl' is enabled.

Upvotes: 1

Related Questions