0

im integrating huawei Services in my app in flutter, and integrating for the backend

I'm using this json to send the push notification

{
        "validate_only": false,
        "message": {
            "data": "{params:{notificationType: Test, ticketId: Test}}",
            "android": {
                "ttl": "1296000",
                "delivery_priority": "HIGH",
                "notification": {
                    "title": data.title,
                    "body": data.body,
                    "click_action": {
                        "type": 3
                    },
                    "importance": "NORMAL",
                    "default_sound": true,
                    "use_default_vibrate": true,
                    "use_default_light": true,
                    "visibility": "PUBLIC"
                }
            },
            "token": tokens,
        }
    }

But when the device receive the notification this not do anything, and i need to alert the user, with sound and vibrate if is configured

With FCM the notification sound and vibrate when is receive as default but no with huawei services, any idea?

Jonathan Ixcayau
  • 567
  • 3
  • 14

1 Answers1

0

First,before you sending the push notification,you can try to set the following on your phone to see if it's working.

Go to Settings > Notifications > Search your app > Regular notifications > Set the sound and vibrate.


And also,If you want to customize sound and sound effects, you can refer the following:

Vibration:

please check that EMUI version is later than 10.0.0 and Push Service APP version is later than 10.1.0.

In order to customize the vibration pattern of the local notification messages, you need to add the permission below to the AndroidManifest.xml file:

<uses-permission android:name="android.permission.VIBRATE" />

Playing Custom Sound for a Local Notification Message:

Firstly, please check that EMUI version is later than 9.1.0 and Push Service APP version is later than 9.1.1.

To play a custom sound for a local notification message, you should add your sound file as a raw resource.

The path for raw resources is <your_flutter_project>/android/app/src/main/res/raw/

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • Thanks, but everything is configured like documentation indícates. I just want to know if the push kit plays a sound when the notification arrives, or this has to been configured manually, or something? With services like OneSignal the sound is play by default – Jonathan Ixcayau Jun 16 '21 at 01:22
  • hi@JonathanIxcayau,may i ask Is your test phone from Chinese Mainland?And also what is the version of the Push Kit that you have integrated? – zhangxaochen Jun 16 '21 at 01:39
  • I'm using flutter, but the package use com.huawei.hms:push:4.0.3.300 version, sorry, I don't know where I can see where the device is from – Jonathan Ixcayau Jun 16 '21 at 02:43
  • hi@JonathanIxcayau,It is recommended that check whether the ring mode is set in Settings > Sound and Vibration, If the problem persists, you are advised to upgrade to the [Push kit latest version](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/version-change-history-0000001050417995?ha_source=hms1) and try again. – zhangxaochen Jun 16 '21 at 06:23