Comments (11)
Hi @rayansys
Could you provide a bit more info please? Perhaps some detail on what you're trying to do and where you hit this issue.
Fireball cloud messaging doesn't really have channels, but topics instead. Topics are fully supported by php-fcm.
More info...
https://firebase.google.com/docs/cloud-messaging/android/topic-messaging
https://php-fcm.readthedocs.io/en/latest/message.html#notification-message-topics
Sorry if I've misunderstood the issue.
from php-fcm.
The notification's channel id (new in Android O).
The app must create a channel with this channel ID before any notification with this channel ID is received.
If you don't send this channel ID in the request, or if the channel ID provided has not yet been created by the app, FCM uses the channel ID specified in the app manifest.
from php-fcm.
Thanks for the quick reply.
The php-fcm library just really wraps functionality in provided by firebase cloud messaging. If you can point us to the fcm docs about channels, that'd be handy.
Previously I've used other messaging systems that used the term channels, like Appcelerator ACS. It was my understanding that the concept channels is kind of implemented as topics now in FCM, but I'm not really sure.
from php-fcm.
@AndyGaskell @rayansys - yeah, I don't understand the request. TopicIDs are managed by php-fcm. Can you point us to some documentation about what you are referring to please?
from php-fcm.
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification
from php-fcm.
Thanks for the link. I'll do some reading on that. I guess we've not implemented it because it's Android only.
from php-fcm.
@AndyGaskell - I did a quick read, it looks like channel ID
allows you to setup different types of notifications within your app which then allows users to turn off/on specific types of Push Notifications versus just ALL ON or ALL OFF. Which I do like. It allows the user to customize, via Android settings, what components inside each app can notify and how they can notify (sound, buzz, popup, silent in background, etc). I wonder if Apple will do the same soon too?
https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels
from php-fcm.
just add "android_channel_id" to request header
from php-fcm.
Cool, am understanding it a bit more now. Thanks for the notes @rolinger
I guess we've only ever implemented the cross platform features of FCM, we could do the platform specific ones too.
So, looking at https://firebase.google.com/docs/reference/fcm/rest/v1/projects.message we could add other functions to add android, webpush and apns. This could maybe be done in the same way as the addData, so we'd have $notification->addAndroidConfig($android_config_object);
, $notification->addWebpushConfig($webpush_config_object);
and $notification->addApnsConfig($apns_config_object);
This is a bit like how the FirebasePHP lib does it, see https://firebase-php.readthedocs.io/en/5.7.0/cloud-messaging.html#adding-target-platform-specific-configuration
Another option, which would be much quicker, would be to just add another parameter to the Notification constructor for the channel. Then, I guess, add a setChannel function. If we did it this way it'd just work in the same way as sounds, icon, colour etc. It'd be a bit of a mess if we wanted to add other platform specific options though.
https://github.com/EdwinHoksberg/php-fcm/blob/master/src/Push/Notification.php
One thing I'm a bit worried about is how we'd test all this, at a system level.
Also @rayansys I'm a bit confused about how you mention adding it to the header. From the docs it looks like it goes in the json body.
from php-fcm.
Thanks for the PR @rayansys this is a nice simple aproach, but I'm not sure how it'll scale out to other Android, iOS and Web config options.
PR at...
Update Notification.php #30
from php-fcm.
Thanks for the PR @rayansys this is a nice simple aproach, but I'm not sure how it'll scale out to other Android, iOS and Web config options.
PR at...
Update Notification.php #30
This functionality would be really nice to have, @AndyGaskell will you only accept a design similar to what you described in your previous comment regarding addAndroidConfig(), addApnsConfig()?
from php-fcm.
Related Issues (20)
- Documentation not consistent with composer package HOT 8
- Increase automated test coverage to 100%
- Guzzle option, made a bit of a mess of the commit / merge HOT 2
- Sending to multiple topics fails HOT 4
- Improve documentation
- If you add more than five topics in FCM, the push doesn't send
- Tag a new version for Guzzle 7 HOT 5
- Optional Laravel support HOT 3
- Priority settings missing? HOT 4
- Add TTL in Notification? HOT 1
- addTopic in && non only in || HOT 9
- If you send a data only push, and empty message is sent HOT 1
- Not Registered in Results => remove device_id HOT 3
- content_available field HOT 1
- Feature request: set time out value HOT 1
- Missing collapse key HOT 5
- Cloud Messaging API (Legacy) Deprecated HOT 2
- Tests not running as documented HOT 2
- Notification Received on mobile but not vibrating HOT 1
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 php-fcm.