Comments (2)
Hey guys,
I found a way to make it work for now, hope it helps someone.
I know is now the best way but it can make it until Rich or someone more experienced answer the issue.
First i changed the config property use_multi_curl to false.
Then your code can look like the sample bellow:
if($platform == 'gcm') {
$pushResponses = $pushNotificationService->getResponses('rms_push_notifications.os.android.gcm');
$pushResponse = (isset($pushResponses[0])?$pushResponses[0]:'');
if($pushResponse) {
$pushResponseContent = $pushResponse->getContent();
if(strpos($pushResponseContent, 'NotRegistered') !== false) {
//Remove the token from your database here
}
}
}
from rmspushnotificationsbundle.
@GuilhermeMoura1 Thanks for the snippet. With that one I came up to the following implementation for checking the response in general (not only for "NotRegistered"). This is just an action method in one of my controllers I have been using to test the push services (I just post this here in case of anyone is interested):
/**
* @Route("/push-test")
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function pushTestAction() {
// … use RMS here to send push notifications
// now get the response for android similar to the code above by GuilhermeMoura1
/** @var Response[] $pushResponses */
$pushResponses = $this->get('rms_push_notifications')->getResponses('rms_push_notifications.os.android.gcm');
$responses = [];
foreach ($pushResponses as $pushResponse) {
// this is a JSON string
$responseContent = $pushResponse->getContent();
// let's decode it
$responseData = json_decode($responseContent, true);
// add to list of responses
$responses[] = $responseData;
}
return $this->json([
'respones' => $responses,
]);
}
from rmspushnotificationsbundle.
Related Issues (20)
- How to set title on iOS Push message? HOT 2
- Cannot send localized notifications HOT 1
- Support for Firebase Cloud Messaging HOT 7
- unpack() in AppleNotificaion produces a notice HOT 1
- Is this project still maintained ? HOT 1
- Notify IOS Devices Via GCM
- FCN Notifications trouble HOT 1
- Support for Web Push Notifications? HOT 1
- Bundle maintained and manage Firebase message HOT 4
- Support for APN Auth Key
- Response null when sending an Android push notification
- Does this bundle currently support FCM? HOT 6
- app.ERROR: {"command":8,"status":7,"identifier":0} HOT 1
- Breaks with Buzz v0.17.x HOT 7
- Send within doctrine.onFlush listener
- Command rms:test-push is not available in Symfony>=4
- [app] {"command":8,"status":8,"identifier":0}
- Issues with objects in Android Notifications
- Apple HTTP/2 APNS -- push notification support HOT 3
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 rmspushnotificationsbundle.