Push Message with quote

0 votes

Hello ,

I need to send a push message with sound and badge.

I write this Code:


$msg="Hello World";
$title = "My App Title";
$user = "xxxxx";


App42API::initialize($APP42_API, $APP42_KEY);
App42API::setLoggedInUser("xxxxx");
$pushNotificationService = App42API::buildPushNotificationService();
$msgJs = "{'alert':'$msg','title':'$title','badge':1,'sound':'default','sendingFrom':'serverSide'}";

$pushNotification = $pushNotificationService->sendPushMessageToUser($user, $msgJs);

This work fine and notifications arrive.

But if I want to send this message :


$msg="Thank's Baby";
$title = "My App Title";
$user = "xxxxx";


App42API::initialize($APP42_API, $APP42_KEY);
App42API::setLoggedInUser("xxxxx");
$pushNotificationService = App42API::buildPushNotificationService();
$msgJs = "{'alert':'$msg','title':'$title','badge':1,'sound':'default','sendingFrom':'serverSide'}";

$pushNotification = $pushNotificationService->sendPushMessageToUser($user, $msgJs);

The message don't arrive to the phone's

I also try 

$msg=addslashes("Thank's Baby");

But don't send nothing.

I don't receive any error.

 

Can you help Me.

Best regards

asked Apr 1, 2016 in PHP by odf (37 points)

2 Answers

0 votes
Hello odf,

Team is looking into it and will get back to you as soon as possible.

Thanks.
answered Apr 2, 2016 by rajeev.etc (1,660 points)
0 votes

Hi odf,

 

At the time of sending (') sign in the message to user, you can add "/" and send it. It will resolve your issue, if you still face any issue then let me know. 

Please find below code snippet for the same:

$msgJs = '{"alert":"Thank\'s Baby","title":"My App Title","badge":1,"sound":"default","sendingFrom":"serverSide"}';
$messageAfterAddSlahes =  addslashes($msgJs);
$pushNotification = $push->sendPushMessageToUser($userName, $messageAfterAddSlahes );
 
Regards,
Himanshu Sharma
answered Apr 4, 2016 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...