title: Custom sound for Android Push Notification not working (FCM)
body: <p>I have push notifications working using FCM from a cloud function. This works for both iOS and Android and displays the appropriate icon and plays a custom sound on iOS.</p>
  
  <p><strong>All is working except the custom sound for Android, it simply plays the default sound.</strong></p>
  
  <p>I have created a folder and added my sound file to it as follows: <code>android\app\src\main\res\raw\mp3_example.mp3</code></p>
  
  <p>This mp3 is 27s long.  I have also tried a .wav and .aiff.</p>
  
  <p>I read that I may have to create a push notification channel for later versions of Android so it could be related to this.  I tried creating a channel and using the channelID from the cloud function and it works but there is no sound just a vibration.</p>
  
  <p>The test device is a Moto G6 running Android 8.
  I am using:
  FCM
  Firebase Cloud Functions
  Ionic 4
  Capacitor
  <a href="https://github.com/stewwan/capacitor-fcm" rel="noreferrer">https://github.com/stewwan/capacitor-fcm</a></p>
  
  <p>Cloud Function:</p>
  
  <pre><code>const notification: admin.messaging.Notification = {
        title: title,
        body: body
    }
  
    const message: admin.messaging.Message = {
      notification,
      topic: 'QMTBC',
      android:{
        notification:{
          sound: 'mp3_example.mp3',
          icon: 'push_logo',
          color: '#000000'
        }
      },
      apns:{
          payload:{
            aps: {
              sound: 'gears-short.wav'
            }
          }
      }
    }
  
    return admin.messaging().send(message)
  </code></pre>
  
  <p>app.component.ts</p>
  
  <pre><code>import { FCM } from 'capacitor-fcm';
  
  const fcm = new FCM();
  const { PushNotifications } = Plugins;
  
  initializeApp() {
      this.platform.ready().then(() =&gt; {
  
        PushNotifications.register();
  
        PushNotifications.addListener('registration', (token: PushNotificationToken) =&gt; {
          console.log('token ' + token.value);
          fcm
          .subscribeTo({ topic: 'QMTBC' })
          .then(r =&gt; console.log(`subscribed to topic`))
          .catch(err =&gt; console.log(err));        
        });
  
        PushNotifications.addListener('registrationError', (error: any) =&gt; {
          console.log('error on register ' + JSON.stringify(error));
        });
  
        PushNotifications.addListener('pushNotificationReceived', (notification: PushNotification) =&gt; {
          console.log('notification ' + JSON.stringify(notification));
          this.pushNotificationService.notifications.push(notification);
        });
  
        PushNotifications.addListener('pushNotificationActionPerformed', (notification: PushNotificationActionPerformed) =&gt; {
          console.log('notification ' + JSON.stringify(notification));
          this.pushNotificationService.notifications.push(notification);
        });
  
        fcm.getToken()
          .then(r =&gt; console.log(`Token ${r.token}`))
          .catch(err =&gt; console.log(err));
      });
    }
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I tried creating a channel as follows.
  If I use the channel I just get the default sound.  If I specific no channel or one that does not exist I also get the default sound (default channel).</p>
  
  <p>cloud function:</p>
  
  <pre><code>const message: admin.messaging.Message = {
      notification,
      topic: 'QMTBC',
      android:{
        notification:{
          sound: 'punch.mp3',
          icon: 'push_logo',
          color: '#000000',
          channelId: 'QMTBC'
        }
      }
  </code></pre>
  
  <p>app.component.ts</p>
  
  <pre><code>const channel: PushNotificationChannel = {
            description: 'QMTBC',
            id : 'QMTBC',
            importance: 5,
            name : 'QMTBC'
          };
  
          PushNotifications.createChannel(channel).then(channelResult =&gt; {
            console.log(channelResult);
            console.log('Channel created');
            // PushNotifications.listChannels().then(channels =&gt; {
            //   console.log('Channels');
            //   console.log(channels);
            // });
          }, err =&gt; {
            console.log('Error Creating channel');
            console.log(err);
          });
        });
  </code></pre>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>I can see the channel I have created for the app on my device and it says the sound is default.  I can manually change it to another inbuilt android sound and this works.  But I still can't use my custom sound.</p>
  
  <p>UPDATE 3:</p>
  
  <p>The custom sound works on if the Android version is &lt; 8.  Only tested this on an emulator.</p>