IBM Worklight 5.0.6 - Play custom sound on push no

2019-07-26 05:10发布

问题:

I've folow this tutorial : IBM Worklight 5.0.5 - Play custom sound on push notification

but get an error:

回答1:

The problem is that you placed the raw folder in the wrong location.
It should be INSIDE the res folder.

If you don't have a nativeResources folder in your project, just make sure to create a raw-named folder in the native\res folder and place the sound file there.

Just as FYI:

  1. I've imported the Push Notifications project
  2. Updated application-descriptor.xml with my GCM ID and Key
  3. Edited the adapter's *-impl.js file with:

    WL.Server.notifyAllDevices(userSubscription, {
          badge: 1,
          sound: "alarma.wav",
          activateButtonLabel: "ClickMe",
          alert: notificationText,
          payload: {
              foo : 'bar'
          }
      });
    
  4. Placed alarama.was in the nativeResources's raw folder


  5. Deployed adapter
  6. Built and deployed application
  7. Launched in device running Android OS v4.0.4
  8. Logged-in with user "Idan"
  9. Sent the notification text "test" to user "Idan"
  10. Received it in device with the horrible alarma sound file I placed in the project