Skip to content

Commit 3de1414

Browse files
authored
Merge pull request #144 from hansemannn/docsAndroidSound
Readme update
2 parents 09ef96d + 05e0c17 commit 3de1414

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ Supported notification fields:
192192
* "sound" => "string" (e.g. "notification.mp3" will play /platform/android/res/raw/notification.mp3)
193193
194194
### Android: Note about custom sounds
195-
To use a custom sound > Android O you need to create a second channel. The default channel will always use the default notification sound on the device!
195+
To use a custom sound you have to create a second channel. The default channel will always use the default notification sound on the device!
196+
If you send a normal or mixed notification you have to set the `android_channel_id` in the `notification` node. If you send a data notification the key is called `channelId`. Chech <a href="#extended-php-android-example">extended PHP Android example</a> for a PHP example.
196197
197198
#### Android: Note for switching between v<=v2.0.2 and >=v2.0.3 if you use notification channels with custom sounds
198199
With versions prior to 2.0.3 of this module, FirebaseCloudMessaging.createNotificationChannel would create the notification sound uri using the resource id of the sound file in the `res/raw` directory. However, as described in this [android issue](https://issuetracker.google.com/issues/131303134), those resource ids can change to reference different files (or no file) between app versions, and that happens the notification channel may play a different or no sound than originally intended.
@@ -603,13 +604,14 @@ Run it locally with `php filelane.php` or put it on a webserver where you can ex
603604
<?php $url = 'https://fcm.googleapis.com/fcm/send';
604605

605606
$fields = array (
606-
'to' => "TOKEN_ID",
607-
// 'to' => "/topics/test",
608-
/* 'notification' => array (
609-
"title" => "TiFirebaseMessaging",
610-
"body" => "Message received 📱😂",
611-
"timestamp"=>date('Y-m-d G:i:s'),
612-
),*/
607+
'to' => "TOKEN_ID", // specific ID
608+
// 'to' => "/topics/test", // topic
609+
// 'notification' => array (
610+
// "title" => "TiFirebaseMessaging",
611+
// "body" => "Message received 📱😂",
612+
// "timestamp"=>date('Y-m-d G:i:s'),
613+
// "android_channel_id" => "my_other_channel"
614+
// ),
613615
'data' => array(
614616
"test1" => "value1",
615617
"test2" => "value2",

0 commit comments

Comments
 (0)