Giter Site home page Giter Site logo

Comments (5)

andrehtissot avatar andrehtissot commented on June 3, 2024

There is a huge chance it might be related to how the device's default notification importance is handled in that particular device model.

To test if this is the issue. I recommend that you create a high importance public channel, like bellow:

FCMPlugin.createNotificationChannelAndroid({
  id: "urgent_alert", // required
  name: "Urgent Alert", // required
  description: "Very urgent message alert",
  importance: "high", // https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
  visibility: "public", // https://developer.android.com/training/notify-user/build-notification#lockscreenNotification
});

And when send to FCM through the API, add the android_channel_id attribute, like bellow:

{
  "notification":{
    "title":"Notification title",
    "body":"Notification body",
    "click_action":"FCM_PLUGIN_ACTIVITY",
  },
  "data":{
    "param1":"value1",
    "param2":"value2"
  },
  "to":"TOPIC OR DEVICE TOKEN",
  "priority":"high",
  "android_channel_id":"urgent_alert"
}

from cordova-plugin-fcm-with-dependecy-updated.

xuanphu123 avatar xuanphu123 commented on June 3, 2024

i tried above code.. but still can't show notification when locked screen. My device using is xiaomi, android 7.1.2.
image

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 3, 2024

You set visibility as "private". Would try to create a new channel setting as "public"?
Just as a test?
As channels created are immutable, you would have to uninstall and install again, or change here the id and name for something else and, in the push payload add the "android_channel_id" to the new one.

from cordova-plugin-fcm-with-dependecy-updated.

xuanphu123 avatar xuanphu123 commented on June 3, 2024

Yes.. just set "private" for test. I tried change the channel id.. my phone can recieve notification with sound.. but still can't show the message on lock screen .
I tried samsung phone can working... so I think this issue is private config of xiaomi phone.

from cordova-plugin-fcm-with-dependecy-updated.

andrehtissot avatar andrehtissot commented on June 3, 2024

A model-specific android version might take this importance as a suggestion and act differently.
As far as I know, there is official no way to force it.

from cordova-plugin-fcm-with-dependecy-updated.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.