Comments (15)
@Edujugon sir aim getting this error please help exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Edujugon\PushNotification\PushNotification' not found' in
Use use Edujugon\PushNotification\PushNotification;
at the top of your file
from pushnotification.
Hello,
Notice that the showed code is not using the facade so kindly confirm your use statement at the head of your class is something like this:
use Edujugon\PushNotification\PushNotification;
And no like this:
use Edujugon\PushNotification\Facades\PushNotification;
from pushnotification.
Perfect thanks for that.
Now onto the last part... I get
stdClass Object ( [success] => 1 [failure] => 2 [tokenFailList] => Array ( [0] => deviceToken2 [1] => deviceToken3 ) )
I added the default device tokens to test errors
So it looks like it's completing but no pushes are received. I have tried in dry run and prod.
I am getting the deviceToken via:
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
var token: String = ""
for i in 0..<deviceToken.count {
token += String(format: "%02.2hhx", deviceToken[i] as CVarArg)
}
print("tokenString: \(token)")
}
from pushnotification.
@dantaylorseo
After checking your details, I suggest you to check on the mobile app side. As you can see in the push service response, it shows 1 success which that token is the one you create. So the token is correct and for the push service provider the notification has been sent.
Maybe the app is not getting the notifications as expected. Did you check that yet?
from pushnotification.
@Edujugon If I use PushMeBaby to test the deviceToken I get the notifications from there using the same deviceToken and pem file.
from pushnotification.
Could you please show me the code what you're using to send the notification?
from pushnotification.
$push = new PushNotification('apn');
$push->setMessage([
'aps' => [
'alert' => "This just in!",
'sound' => 'default'
],
'extraPayLoad' => [
'custom' => 'My custom data',
]
]);
$push->setDevicesToken(['5a66cf3f8022a923fd7d8cf3503ca0dd91a1e26b187170e1497907188e542b5f']);
$push->send();
from pushnotification.
@Edujugon strangely if I use the code below it works fine. I can't see much different from your code?
$deviceToken = '5a66cf3f8022a923fd7d8cf3503ca0dd91a1e26b187170e1497907188e542b5f';
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', config_path( 'iosCertificates/apns-dev-cert.pem' ) );
// Open a connection to the APNS server
$fp = stream_socket_client(
'ssl://gateway.sandbox.push.apple.com:2195', $err,
$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp)
exit("Failed to connect: $err $errstr" . PHP_EOL);
echo 'Connected to APNS' . PHP_EOL;
// Create the payload body
$body['aps'] = array(
'alert' => "Another test",
'sound' => 'default',
);
// Encode the payload as JSON
$payload = json_encode($body);
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));
if (!$result)
echo 'Message not delivered' . PHP_EOL;
else
echo 'Message successfully delivered' . PHP_EOL;
// Close the connection to the server
fclose($fp);
from pushnotification.
@dantaylorseo
Is the dry_run param sets as false in config file?
from pushnotification.
@Edujugon No as my device is in development
from pushnotification.
@dantaylorseo
Could I try from my side to send you a notification using the provided device token?
from pushnotification.
Yes
from pushnotification.
In order to send the test I'll need the certificate and the passPhrase.
Could you send it to [email protected]?
By the way, in the above code you say it works, you're using the apple sandbox gateway. If the certificate you're using is for testing purposes, In this package you should update the config dry_run value to true.
Could you do a try with the mentioned changes?
from pushnotification.
It was an issue when assigning the proper gateway for apn.
It has been fixed and it works as expected.
from pushnotification.
@Edujugon sir aim getting this error please help exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Edujugon\PushNotification\PushNotification' not found' in
from pushnotification.
Related Issues (20)
- Unable to send notifications via FCM.
- Content-Type:" is not valid header name HOT 6
- Document breaking change in v4.5.1?
- [L 6.0]Testing push notification
- Breaking change in 4.5.1: Undefined index: headers HOT 2
- loc-key and loc-args on the payload
- Undefined index: headers HOT 7
- Need support of Voip
- Badge count not working with fcm
- Push notiication not working on Ios
- update to newer versions
- notifications not sendings HOT 2
- Installation issue with laravle9.2 HOT 4
- Issue in Laravel 9.2 HOT 7
- FCM Api Key HOT 2
- add support for huawei
- cannot send push notifications(ios, android)
- Error al crear $push = new PushNotification
- MissingTopic HOT 1
- Migrating from legacy FCM to HTTP v1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pushnotification.