edujugon / pushnotification Goto Github PK
View Code? Open in Web Editor NEWPHP and Laravel Package to send push notifications to Android and IOS devices.
License: MIT License
PHP and Laravel Package to send push notifications to Android and IOS devices.
License: MIT License
Hi,
I am using Laravel 5.2
I am getting below error while trying to sent push notification on IOS device using APN
{#596 ▼
+"success": false
+"error": "Please, add your APN certificate to the iosCertificates folder.\n"
}
I have added the APN certificate. Still I am getting this error.
'apn' => [
'certificate' => DIR . '/iosCertificates/pushcertdev.pem',
'passPhrase' => '1234', //Optional
//'passFile' => DIR . '/iosCertificates/yourKey.pem', //Optional
'dry_run' => false
]
Hi, i have question about APNS connection
ERROR
"success": false
"error": "Connection problem: stream_socket_client(): Unable to set local cert chain file `C:\xampp\htdocs\application_name\config/iosCertificates/aps_development.cer'; Check that your cafile/capath settings include details of your certificate and its issuer\r\n"
Thanks in Advance, please mention if irrelevant to package
I am new to Laravel and Pushnotification as well, I am using below code t send push notification
$respone = PushNotification::setService('fcm')
->setMessage([
'notification' => [
'title'=>'Sheep App notofication',
'body'=>'A user try to contact you',
'sound' => 'default'
]])
->setApiKey('AAAAxO2N17Q:APA91bGS5s7qy0larSwA0SOnz-5hv-Ls62hKJI3A5Q1ReKfgicl-aT2kB4hW-wpKt3sOV_q1rPGaWJRaKRv8tZ2rq99DTCq1ffqujKhsxOqObXjHTCGdzr2y8aBH_N9TZ874Mmx7IZux')
->setDevicesToken(['ewGx_pBcDzI:APA91bH1JQIpQyqsik5RM_wtAAkrCb035Vkh8DQxSuv6X2qr3QlooVb5-b_y1lB9x3Jk1i9URC9LjA2UgbrVWQmlYu82rrwKzfTNrDt7qGfkbR60lr3lNk3alAUWoANIQWe60linN96i'])
->send()
->getFeedback();
I am getting fake_message_id Error Please help me to solve the Issue.
Hi I am getting the following error:
Call to undefined method Edujugon\PushNotification\Facades\PushNotification::setMessage()
This is my code:
$push = new PushNotification('apn');
$push->setMessage([
'aps' => [
'alert' => [
'title' => 'This is the title',
'body' => 'This is the body'
],
'sound' => 'default'
],
'extraPayLoad' => [
'custom' => 'My custom data',
]
])
->setDevicesToken(['DEVICE_TOKEN_HERE']);
$push->send();
Also if I use the facade I get success code but no notifications received, any ideas?
First of all, thanks for this lib.
One problem here, when I try to send apns notification its delivered successfully but seems like apns getFeedback method is failing with following error: stream_socket_client(): unable to connect to (Failed to parse address "")
Config is regular, just cert and passPhrase added.
Stack trace:
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'stream_socket_c...', '/var/www/html/v...', 294, Array)
#1 /var/www/html/vendor/edujugon/push-notification/src/Apn.php(294): stream_socket_client('', 0, 'Failed to parse...', 60, 4, Resource id #370)
#2 /var/www/html/vendor/edujugon/push-notification/src/Apn.php(260): Edujugon\PushNotification\Apn->apnsFeedback()
#3 /var/www/html/vendor/edujugon/push-notification/src/PushNotification.php(163): Edujugon\PushNotification\Apn->send(Array, Array)
...
This error is shown when trying to send a notification with the following code:
$push = new PushNotification;
$push->setMessage([
'notification' => [
'title'=>'This is the title',
'body'=>'This is the message',
'sound' => 'default',
]
])
->setApiKey('AIzaSyBJalCHbX')
->send();
I have a Certificate with a pass phrase and when I use it it asks for pass phrase in the console:
Enter PEM pass phrase:
My configuration:
'apn' => [
'certificate' => __DIR__ . '/iosCertificates/certificate2.pem',
'passPhrase' => '1234', //Optional
// 'passFile' => __DIR__ . '/iosCertificates/yourKey.pem', //Optional
'dry_run' => true
]
My code:
$push = new PushNotification('apn');
$push->setMessage([
'aps' => [
'alert' => [
'title' => $data['title'],
'body' => $data['description']
],
'sound' => 'default'
],
'extraPayLoad' => [
'type' => $data['type'],
'id' => $data['id'],
]
])
->setDevicesToken([$devicetoken])
->send();
After writing 1234 in the console it sends the notification. Am I missing something?
If dry_run is set to 'false', it seems to send without error, but push notification is never received in the iPhone.
classes and alias are added in config/app.php
getting an error edujugonPushNotification
class not found. my laravel version is 5.4
Is it possible to send push notifications over proxy address?
Thank You!
its happens in "laravel/framework": "5.4.*"
Not an issue per-se just a feature request. Is there any way you could modify this to use .p12 or .pem files?
It would just remove the extra step of generating the .pem
I have the following:
$push->setDevicesToken(
[
'507e3adaf433ae3e6234f35c82f8a43ad0d84218bff08f16ea7be0869f066c03',
'507e3adaf433ae3e6234f35c82f8a43ad0d84218bff08f16ea7be0869f066c04',
'507e3adaf433ae3e6234f35c82f8a43ad0d84218bff08f16ea7be0869f066c03',
]);
The script only sends the first one (which is a correct deviceToken, I have purposely changed the middle one). If you change the loop in Apn.php it works. Is it valid to write more than one device token at a time to Apple?
If all three are the same, i.e none fail it shows 3 times, which is correct.
Hi,
I am first time using this package and this is perfect when am using push notification using APN, But now am trying with GCM added api token and device id but response seems there is no error. But not yet i dont receive any push.
use Edujugon\PushNotification\PushNotification;
Controller
$push = new PushNotification();
$push->setMessage([
'notification' => [
'title'=> 'Nithin push kittumbo para - android',
'body'=> 'Nithin push kittumbo para - android',
'sound' => 'default'
],
'data' => [
'extraPayLoad1' => 'value1',
'extraPayLoad2' => 'value2'
]
])
->setApiKey('AAAAzNWar6k:APA91bFifq79w9hjoEnuwDv1swLhG0GM0_bim2gfDoJZmg0gwKwqmH6byd5fUcAwfPwWsfJJ4Vy0JO2Ajf0d6c-hW5y70SIelBr5POAJOUDuHWesz_Bt5HOsBoe3Kum')
->setDevicesToken(['APA91bGN-Ng4CaQyWqMfzcmu21kU-HWyLwIS8yoR2U7K_ZYRF6MS8ARqSkb3encMr2sxft8wtmZUbkrTUwZP0P8UURLwVgsLe3DU7UD-CjSvkPWMabKMGUXviTEjjfq4QLmqf7GtH6d5'])
->send();
pushnotification.php
return [
'gcm' => [
'priority' => 'normal',
'dry_run' => true,
'apiKey' => 'AAAAzNWar6k:APA91bFifq79w9hjoEnuwDv1swLhG0GM0_bim2gfDoJZmg0gwKwqmH6byd5fUcAwfPwWsfJJ4Vy0JO2Ajf0d6c-hW5y70SIelBr5POAJOUDuHWesz_Bt5HOsBoe3Kum',
],
'fcm' => [
'priority' => 'normal',
'dry_run' => false,
'apiKey' => 'My_ApiKey',
],
'apn' => [
'certificate' => DIR . '/iosCertificates/SprightlyPushCert.pem',
'passPhrase' => '1234', //Optional
'passFile' => DIR . '/iosCertificates/yourKey.pem', //Optional
'dry_run' => false
]
];
I have gone through the documentation and only found the option to set PEM file for sending APNs.
When i was testing the push notification on development it works perfectly, but after I commit it on app store and downloaded it, push notification does not work, any idea what is wrong?
should the ios guy change the url for production
/**
* Url for development purposes
*
* @var string
*/
private $sandboxUrl = 'ssl://gateway.sandbox.push.apple.com:2195';
/**
* Url for production
*
* @var string
*/
private $productionUrl = 'ssl://gateway.push.apple.com:2195';
/**
Hi There,
I have used your doc and manage to send push and I get feedback below but not receiving any notification on my iPhone.
{
"success": 1,
"failure": 0,
"tokenFailList": []
}
{"success":false,"error":"cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"}
$push= PushNotification::setService('fcm')
->setMessage([
'notification' => [
'title'=>'This is the title',
'body'=>'This is the message',
'sound' => 'default'
],
'data' => [
'extraPayLoad1' => 'value1',
'extraPayLoad2' => 'value2'
]
])
// ->setApiKey('Server-API-Key')
->setDevicesToken(['dGwMZ7AiI-k:APA91bFBbw_gX48VYJGSw2MpEtz4hEZUd2occkvkzeR3NKMqNVipYxB4oWEBOlOU_aZU5IFnoPiN-pfZSv4VIUwIuL0eAt7UYl4wmz-LXTwJOmyvVztq7Fn0s6sTuil1_LcA82YKCE0-'])
->send()
->getFeedback();
I am confused
I use FCM and i need to add apiKey to config
Is it Web API Key
or Server key
or Legacy server key
?
I found the 3 keys in my app account, which one i must use ?
Hi there!
I found that missed config for apn throws an exception:
Undefined index 'apn' on PusherService.php line 69.
I think it will be great to add an exception with message like Config 'apn' missed in pushnotifications.php
Hello @Edujugon,
I getting Out Of Memory error sending push to iOS.
I tried with develop and production url of Apple, but is always same error.
PHP v5.6.30
edujugon/push-notification: v2.2.0
publishing the config file ends with error in laravel 5.4 as Illuminate\Foundation\Application::share()
been deprecated.
vendor/edujugon/push-notification/src/Providers/PushNotificationServiceProvider.php on line 32
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::share()
Does this package allows to send image push noti for ios?
Sorry for having to create another issue so quick but i can't seem to utilise the package if I declare an instance of the facade.
$push = new PushNotification('fcm');
$push->setMessage([
'notification' => [
'title'=>'This is the title',
'body'=>'This is the message',
'sound' => 'default'
],
'data' => [
'extraPayLoad1' => 'value1',
'extraPayLoad2' => 'value2'
]
])
->setDevicesToken('token');
Having the above code will throw the following error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Edujugon\PushNotification\Facades\PushNotification::setMessage()
With app notifications, getFeedback() provides data in two different formats.
When a push fails for connection reasons, the format of getFeedback() is:
['success' => bool, 'error' => string]
e.g., https://github.com/Edujugon/PushNotification/blob/master/src/Apn.php#L175
If it passes, or fails on Apple's side, then the format of getFeedback() is:
['success' => int, 'failure' => int, 'tokenFailList' => [int], $apnsFeedback => [stuff]]
e.g., https://github.com/Edujugon/PushNotification/blob/master/src/Apn.php#L405
I was expecting the getFeedback() result to have the same structure, albeit with different values.
Was this a deliberate choice? Would a pull request to make them return in a single format be welcome? It would obviously be a potentially breaking change.
If it would be welcome, I would think of making the first case return ints for success and failure, with the appropriate number given how far it got before the fail, and adding an error string field to the second case which would say "Apple provided feedback" or some such if there was a fail from Apple, or nothing otherwise.
in PushNotification.php (line 52)
I am getting the issue. please help to solve this
Is this package meant to not be compatible with 5.0 or 5.1?
I see that you request for minimum version of illuminate/support to be 5.2 which should mean Laravel 5.2 and above?
Problem 1
- Conclusion: remove laravel/framework v5.1.45
- Conclusion: don't install laravel/framework v5.1.45
- edujugon/push-notification v2.1.0 requires illuminate/support ^5.2 -> satisfiable by illuminate/support[v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.4].
- edujugon/push-notification v2.1.2 requires illuminate/support ^5.2 -> satisfiable by illuminate/support[v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.4].
- edujugon/push-notification v2.1.3 requires illuminate/support ^5.2 -> satisfiable by illuminate/support[v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.4].
- edujugon/push-notification v2.1.4 requires illuminate/support ^5.2 -> satisfiable by illuminate/support[v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.4].
- edujugon/push-notification v2.1.5 requires illuminate/support ^5.2 -> satisfiable by illuminate/support[v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.4].
- edujugon/push-notification v2.1.6 requires illuminate/support ^5.2 -> satisfiable by illuminate/support[v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.4].
- don't install illuminate/support v5.2.0|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.19|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.21|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.24|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.25|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.26|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.27|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.28|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.31|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.32|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.37|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.43|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.45|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.6|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.2.7|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.3.0|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.3.16|don't install laravel/framework v5.1.45
- don't install illuminate/support v5.3.4|don't install laravel/framework v5.1.45
- Installation request for laravel/framework (locked at v5.1.45, required as 5.1.*) -> satisfiable by laravel/framework[v5.1.45].
- Installation request for edujugon/push-notification ^2.1 -> satisfiable by edujugon/push-notification[v2.1.0, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6].
I've used this for push notification in my project.
it works for Android.
But it doesn't work for iOS
I've got this error when I try to send push notification.
ErrorException: fwrite(): send of 253 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
in file E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\Apn.php on line 314
Stack trace:
1. ErrorException->() E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\Apn.php:314
2. fwrite() E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\Apn.php:314
3. Edujugon\PushNotification\Apn->send() E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\PushNotification.php:163
4. Edujugon\PushNotification\PushNotification->send() E:\xampp\htdocs\playdate\app\Http\Controllers\ApiController.php:1865
5. App\Http\Controllers\ApiController->send_notification_apple() E:\xampp\htdocs\playdate\app\Http\Controllers\ApiController.php:1774
6. App\Http\Controllers\ApiController->send_notification() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
7. call_user_func_array() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
8. Illuminate\Routing\Controller->callAction() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:45
9. Illuminate\Routing\ControllerDispatcher->dispatch() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Route.php:212
10. Illuminate\Routing\Route->runController() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Route.php:169
11. Illuminate\Routing\Route->run() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Router.php:658
12. Illuminate\Routing\Router->Illuminate\Routing\{closure}() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
13. Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php:41
14. Illuminate\Routing\Middleware\SubstituteBindings->handle() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
15. Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Ill...
This is my config file
'apn' => [
'certificate' => DIR . '/iosCertificates/DevMPD.pem',
'passPhrase' => '@love@', //Optional
'passFile' => DIR . '/iosCertificates/DevMPD.pem', //Optional
'dry_run' => true
]
This is my function for sending pushnotification
$push = new PushNotification('apn');
$extraNotificationData = ["message" => $msg, "user_name" =>$own_name, "user_id"=>$own_id];
$push->setMessage([
'aps' => [
'alert' => [
'title' => 'Development Push',
'body' => 'This is the testing for PRINCE'
],
'sound' => 'default',
'badge' => 1
],
'extraPayLoad' => [
'custom' => $extraNotificationData,
]
])
->setDevicesToken(['c0223b2a800ff6e975e3eef9ac6a484929d7e8ee05610a816b05910b20f0467b']);
$push->send();
Please help me now.
Thanks
stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired in /vendor/edujugon/push-notification/src/Apn.php:184
I have not change anything at all. It just stop working. Before this it works like a charm. Maybe I'm missing something here...
PushNotification::setService('fcm')
->setMessage([
'notification' => [
'title' => "hello",
'body' => "haiii",
'sound' => 'default'
],
'data' => [
'extraPayLoad1' => 'value1',
'extraPayLoad2' => 'value2'
]
])
->setApiKey('My api key')
->setDevicesToken('My device token')
->send()
->getFeedback()
It seems the ->badge()
method on the Messages\PushNotification
class is only available in dev-master
, can you tag a release for this?
hello, could you help me ?
my laravel application running perfectly with apn.
but i got some problem with fcm
PushNotification::setService('fcm') ->setMessage([ 'notification' => [ 'title'=>'This is the title', 'body'=>'This is the message', 'sound' => 'default' ], 'data' => [ 'extraPayLoad1' => 'value1', 'extraPayLoad2' => 'value2' ] ]) ->setApiKey('Server-API-Key') ->setDevicesToken(['deviceToken1']) ->send() ->getFeedback();
after i sending message, it shows
{#309
+"success": false
+"error": "cURL error 51: SSL: certificate verification failed (result: 5) (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"
}
i don't know how to fix it, could you help me?
I am trying to send notification using FCM service to ios app. ON Android using the same code works fine, but not on IOS. I am receiving the data in the foreground and printing it but can't show the badge alert. And in the background nothing is received.
I have tested the IOS part using the FCM notification composer and it is working fine.
this is the data I receive in IOS from my server and using FCM notification composer
My Server
[AnyHashable("from"): 1084873256575, AnyHashable("title"): Event happing near you, AnyHashable("id"): 88, AnyHashable("body"): Nobis et libero temporibus mollitia voluptatem on 2018, Thu 12 Apr 00:00 AM - 00:00 AM, AnyHashable("type"): App\Notifications\UpcomingEvent]
FCM Server
[AnyHashable("google.c.a.c_l"): Test 7, AnyHashable("google.c.a.e"): 1, AnyHashable("google.c.a.ts"): 1523508749, AnyHashable("google.c.a.udt"): 0, AnyHashable("gcm.n.e"): 1, AnyHashable("aps"): {
alert = "Hello World again 2";
}, AnyHashable("google.c.a.c_id"): 3140898793034192784, AnyHashable("gcm.message_id"): 0:1523508749727331%c4ec4979c4ec4979]
This is the data that I am sending
[
'type' => 'App\Notifications\UpcomingEvent',
"id" => $event->id,
"title" => 'Event happing near you',
"body" => $event->title . ' on ' . event_date($event),
"thumbnail" => $event->cover ? event_picture_url($event->cover, 'thumbnail') : null,
];
this is the notification code ::
// getting the data showing above
$event_data = $this->eventService->transformNotification($event);
sending the request
$push = new PushNotification('fcm');
$tokens = DB::table('device_tokens')->pluck('token')->toArray();
$push->setMessage([ 'data' => $event_data ])->setDevicesToken($tokens)->send();
Hi,
Is it possible to use PEM file instead of a pass phrase for APN authentication ?
(file path and file_get_contents don't work :/)
Thanks
Hi, I'm getting this error consistently.
Connection problem: stream_socket_client(): Unable to set local cert chain file `/var/www/public_html/niggle/config/iosCertificates/niggle_push.pem'; Check that your cafile/capath settings include details of your certificate and its issuer.
I can connect to apns server when I add -CAfile entrust-2048-ca.cer to the open ssl command on my local environment.Please help.
I'm using PushNotification in a Laravel 5.2 Artisan Console.
I have PushNotification in a common Helper and works fine, but when I execute in console "push:send", I recieve push notifications in my phone, but console process never completes. My push:send command code is:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\PushQueue;
use Edujugon\PushNotification\Facades\PushNotification;
class SendPush extends Command
{
protected $signature = 'push:send';
protected $description = 'Send Push';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$queue = PushQueue::where('send', 0)->get();
if($queue)
{
foreach($queue as $push)
{
# iOS
if($push->type == 2)
{
$result = PushNotification
::setService('apn')
->setUrl(env('PUSH_IOS_URL'))
->setMessage( [ 'aps' => json_decode($push->config) ] )
->setDevicesToken( json_decode($push->token) )
->send()
->getFeedback()
;
echo "iOS\n";
print_r($result);
echo "/iOS\n";
}
}
}
}
}
My SetUrl value is ssl://gateway.push.apple.com:2195 and I'm using production certificates.
Console never do the "echo" lines
trying to send push and got error, any idea why?
"Use of undefined constant ARRAY_FILTER_USE_KEY - assumed 'ARRAY_FILTER_USE_KEY'"
$push->setMessage([ "notification" => [ "title" => $me->name, "body" => $message, ], "data" => [ "user_id" => 1, "chat_room_id" => 2, "text" => $message, "name" => $me->name, "time" => "momend ago", ] ]) ->setApiKey('api-key') ->setDevicesToken($token) ->send() ->getFeedback();
Hi Edu and congrats x your package;
I m getting this error "response": {
"success": false,
"error": "Connection problem: stream_socket_client(): Unable to set private key file `/var/www/html/ws/config/iosCertificates/aps_development.pem'\n"
}
The path to the to cert is ok.
The file has 644 permissions.
Thanks in advance.
Bellow is my sample notification class. In that i am sending push notification using Apn Channel. But I don't get any response. When i try to dd() in toApn method at that time i get null.
How are you able receive feedback, when using a notification channel with ShouldQueue?
I've tried called getFeedback and getUnregisteredDeviceTokens after the request finished. But I receive either [] or NULL.
The notification is sent and received. I am using both a valid token and an invalid one.
Should I be calling getFeedback/getUnregisteredDeviceTokens another place?
I've succeeded in sending notifications before but now I can't seem to make it work.
If I test it here: http://www.pushwatch.com/apns/ with my PEM file and a token, I successfully receive it. But using this package I can't.
There's no $push->feedback->error and the function getFeedback() also shows success.
My config
'apn' => [
'certificate' => __DIR__ . '/iosCertificates/certificate.pem',
'passPhrase' => '',
'dry_run' => true
]
Sending:
$push = new PushNotification('apn');
$push->setMessage([
'aps' => [
'alert' => [
'title' => $data['title'],
'body' => $data['description']
],
'sound' => 'default'
],
'extraPayLoad' => [
'type' => $data['type'],
'id' => $data['id'],
'body' => $data['description']
],
])
->setDevicesToken([$devicetoken])
->send();
if(isset($push->feedback->error)){
\Log::info('ERRO notificação ios - ' . $push->feedback->error);
} else {
\Log::info('Enviado com sucesso - ' . $devicetoken);
}
My PEM file doesn't have a passPhrase, I tryed with and without the passPhrase line.
Am I missing something?
How to use the p8 file with this library instead of pem file in APNS?
How to set key_id, team_id, and app_bundle_id with this library for p8?
It is not possible to call send() without deviceToken(s) set. The deviceToken(s) are not necessary when sending to topics though.
Class 'App\Http\Controllers\PushNotification' not found.
do you support topics and conditions ?
Hi Edu, great job.
I have a small problem and I can not solve.
The error message is:
Call to undefined method Edujugon\PushNotification\Facades\PushNotification::setMessage()
My Cod to try is
$push = new PushNotification('fcm'); $push->setMessage(['body'=>'This is the message','title'=>'This is the title']); $push->setDevicesToken(['ehsOBEniA6E:APA91bEogPTT0CiRZmsiI8s7CmvR-QybIgt1rD0Kark0K-L-_zllVmBsuC-JOLgyvnunqVSghKPJraE0A4MQ7d3BAA9P2oalhWyNZzBqoyw-l0jUV6M0sXKN5j1p4XpVzu3DFo--ZP4B']); $push->send();
app.conf
My Service Provider:
Edujugon\PushNotification\Providers\PushNotificationServiceProvider::class,
and
'PushNotification' => Edujugon\PushNotification\PushNotification::class,
pushnotification.php
'fcm' => [
'priority' => 'normal',
'dry_run' => false,
'apiKey' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,
]
I really do not know how to solve
Hi , Is it possible to Schedule a notification for future delivery in android?
Is it possible to group messages like whatsapp app?
If yes, how can I do it with FCM?
I am sending data by fcm server. but at android side developer getting response like that.
{imag_uri=https://static.pexels.com/photos/4825/red-love-romantic-flowers.jpg, body=Shy7lo Offer, title=Shy7lo Offer}
That is not well formated json response so user getting error while parsing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.