Giter Site home page Giter Site logo

Comments (16)

Edujugon avatar Edujugon commented on August 11, 2024

Hi @DineeshDS ,
have you tried to set 'dry_run' to false in pushnotification.php/gcm config ?

from pushnotification.

DineeshDS avatar DineeshDS commented on August 11, 2024

yes i have tried with dry_run false

from pushnotification.

Edujugon avatar Edujugon commented on August 11, 2024

Could you show me the feedback after sending the notification?
You just can get it using getFeedback() method

from pushnotification.

DineeshDS avatar DineeshDS commented on August 11, 2024

This is the response

#url: "https://android.googleapis.com/gcm/send"
#config: array:3 [
"priority" => "normal"
"dry_run" => false
"apiKey" => "AAAAzNWar6k:APA91bFifq79w9hjoEnuwDv1swLhG0GM0_bim2gfDoJZmg0gwKwqmH6byd5fUcAwfPwWsfJJ4Vy0JO2Ajf0d6c-hW5y70SIelBr5POAJOUDuHWesz_Bt5HOsBoe3Kum"
]
#feedback: {#6372
+"multicast_id": 7028173908884911686
+"success": 1
+"failure": 0
+"canonical_ids": 0
+"results": array:1 [
0 => {#6335
+"message_id": "0:1530786565588271%7b6555eff9fd7ecd"
}
]
}
}
#servicesList: array:3 [
"gcm" => "Edujugon\PushNotification\Gcm"
"apn" => "Edujugon\PushNotification\Apn"
"fcm" => "Edujugon\PushNotification\Fcm"
]
-defaultServiceName: "gcm"
#deviceTokens: array:1 [
0 => "APA91bGN-Ng4CaQyWqMfzcmu21kU-HWyLwIS8yoR2U7K_ZYRF6MS8ARqSkb3encMr2sxft8wtmZUbkrTUwZP0P8UURLwVgsLe3DU7UD-CjSvkPWMabKMGUXviTEjjfq4QLmqf7GtH6d5"
]
#message: array:2 [
"notification" => array:3 [
"title" => " test"
"body" => "test"
"sound" => "default"
]
"data" => array:2 [
"extraPayLoad1" => "value1"
"extraPayLoad2" => "value2"
]
]

from pushnotification.

Edujugon avatar Edujugon commented on August 11, 2024

After checking the above info, I can say that the notification was sent you.
This is the GCM message id confirming it was sent out successfully: 0:1530786565588271%7b6555eff9fd7ecd

Now, I would recommend to check your client implementation and confirm that it's really getting the notifications.

from pushnotification.

DineeshDS avatar DineeshDS commented on August 11, 2024

Yeah, I have check with my client device , but push notification is not getting, We have tried https://www.pushwatch.com/gcm/ with same api key and device id at that time getting notification.

from pushnotification.

Edujugon avatar Edujugon commented on August 11, 2024

are you using the same message structure as the package use? could you paste here the message you're sending through pushwatch?

The notification feedback is provide by the notification provider, so in this case by GCM server, and its response is successfully. I just can think of there could be some differences between the messages structure.

from pushnotification.

DineeshDS avatar DineeshDS commented on August 11, 2024

Yes, sure

$push = new PushNotification();
$push->setMessage([
'notification' => [
'title'=>'This is the title',
'body'=>'This is the message',
'sound' => 'default'
],
'data' => [
'extraPayLoad1' => 'value1',
'extraPayLoad2' => 'value2'
]
])
->setApiKey('AAAAzNWar6k:APA91bFifq79w9hjoEnuwDv1swLhG0GM0_bim2gfDoJZmg0gwKwqmH6byd5fUcAwfPwWsfJJ4Vy0JO2Ajf0d6c-hW5y70SIelBr5POAJOUDuHWesz_Bt5HOsBoe3Kum_O0sRiLbvIcZX')
->setDevicesToken(['APA91bGN-Ng4CaQyWqMfzcmu21kU-HWyLwIS8yoR2U7K_ZYRF6MS8ARqSkb3encMr2sxft8wtmZUbkrTUwZP0P8UURLwVgsLe3DU7UD-CjSvkPWMabKMGUXviTEjjfq4QLmqf7GtH6'])
->send();

from pushnotification.

Edujugon avatar Edujugon commented on August 11, 2024

I asked for the message you are sending via pushwatch :)

Since the notification response is successful, I just can think of the messages format don't match..

Could you debug the notification in your client app? just if receives something, log it. if you do so, do you see something in the log?

from pushnotification.

DineeshDS avatar DineeshDS commented on August 11, 2024

Sorry , In the client side they can only read those message which send from pushwatch, Client is a Xamarin mobile app, They reporting that they cant access log or message structure

from pushnotification.

Edujugon avatar Edujugon commented on August 11, 2024

Could you try to send the notification like below:

$push->setMessage([
           'title'=>'This is the title',
           'body'=>'This is the message'
       ]);

from pushnotification.

Edujugon avatar Edujugon commented on August 11, 2024

Hi @DineeshDS ,
Any luck with my previous message?

from pushnotification.

DineeshDS avatar DineeshDS commented on August 11, 2024

No, Status is same, Push triggering from my side , But not receiving in client side

from pushnotification.

cosecantt avatar cosecantt commented on August 11, 2024
    $push = new PushNotification('fcm');

    $push->setMessage([
            'title'=>'This is the title',
            'body'=>'This is the message'
        ])
        ->setApiKey(env('GOOGLE_FCM_KEY', false))
        ->setDevicesToken('f2_OPr9e5c4:APA91bHnw6e9NHm3z6bTo0pI0swdjas9h4P9uEgincvyNS0UXPHx071ZIyh3MmJvAjMm3yOYRh4-y16BrsqB08Zw9fzwxiBCDH9BSNuqsRQsikNVq-NRiLlqf4PM_03gA_BMkbNHFgUEy3agGf4s35Af4MlDBAWxKg')
        ->send();

Above sends the message successfully but crashes my app.

Following sends message successfully and the notifications appears on the same app normally.

    $url = "https://fcm.googleapis.com/fcm/send";
    $token = "f2_OPr9e5c4:APA91bHnw6e9NHm3z6bTo0pI0swdjas9h4P9uEgincvyNS0UXPHx071ZIyh3MmJvAjMm3yOYRh4-y16BrsqB08Zw9fzwxiBCDH9BSNuqsRQsikNVq-NRiLlqf4PM_03gA_BMkbNHFgUEy3agGf4s35Af4MlDBAWxKg";
    $serverKey = env('GOOGLE_FCM_KEY', false);
    $title = "Title";
    $body = "Body of the message";
    $notification = array('title' =>$title , 'text' => $body, 'sound' => 'default', 'badge' => '1');
    $arrayToSend = array('to' => $token, 'notification' => $notification,'priority'=>'high');
    $json = json_encode($arrayToSend);
    $headers = array();
    $headers[] = 'Content-Type: application/json';
    $headers[] = 'Authorization: key='. $serverKey;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
    curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
    //Send the request
    $response = curl_exec($ch);
    //Close request
    if ($response === FALSE) {
        die('FCM Send Error: ' . curl_error($ch));
    }
    curl_close($ch);

Any issues?
Thanks.

from pushnotification.

DineeshDS avatar DineeshDS commented on August 11, 2024

@Edujugon issue with push notification is solved , we have implemented FCM in client side. Thank you

from pushnotification.

Edujugon avatar Edujugon commented on August 11, 2024

@DineeshDS cool!
Happy to hear that :)

from pushnotification.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.