Coder Social home page Coder Social logo

Comments (8)

keepfocusontechnology avatar keepfocusontechnology commented on May 26, 2024

@aktug HI aktug , may I ask about the progress of this issue?

from hms-flutter-plugin.

aktug avatar aktug commented on May 26, 2024

Hello @keepfocusontechnology ,
Push SDK does not expose notification's informations, as you can see there are all null. This is not an issue.
My suggestion as a workaround is;
You can send data messages instead of notification thus you can access all properties of data message then use that values with LocalNotification feature 👍

from hms-flutter-plugin.

keepfocusontechnology avatar keepfocusontechnology commented on May 26, 2024

thanks @aktug , The function I want to implement is when my app in background and receive a HW push msg, I click this message and I can parse this message what it Contained data.

How do I do that?

from hms-flutter-plugin.

aktug avatar aktug commented on May 26, 2024
@override
  void initState() {
    super.initState();
    initPlatformState();
    //...
  }
  Future<void> initPlatformState() async {
    if (!mounted) return;
    Push.onNotificationOpenedApp.listen(_onNotificationOpenedApp);
    var initialNotification = await Push.getInitialNotification();
    _onNotificationOpenedApp(initialNotification);
 }
  void _onNotificationOpenedApp(dynamic initialNotification) {
    print(initialNotification.toString());
  }

Thats response is like that :

{
  result: {
    extras: {
      _push_cmd_type: "cosa",
      _push_msgid: "-1744601771",
      _push_notifyid: 1218295586,
      KEY1: "VALUE1",
    },
    remoteMessage: {
      Link: "null",
      NotifyId: "0",
      contents: "0",
      ttl: "86400",
      isDefaultSound: "true",
      ...
    },
    uriPage: "app://app2",
  },
  resultCode: "0",
}

You can use "Key-value pair" part so these values come from the extras part

image

from hms-flutter-plugin.

keepfocusontechnology avatar keepfocusontechnology commented on May 26, 2024

My problem has been solved,Thank you @aktug

from hms-flutter-plugin.

digitex avatar digitex commented on May 26, 2024

Hi, I've the same problem.

@keepfocusontechnology How do you solve it?

from hms-flutter-plugin.

keepfocusontechnology avatar keepfocusontechnology commented on May 26, 2024

@digitex Hi, U want to parse the remoteMessage,the first u must config the intent data refer to the official website.

from hms-flutter-plugin.

NSFriend avatar NSFriend commented on May 26, 2024

@aktug Hello

```dart
@override
  void initState() {
    super.initState();
    initPlatformState();
    //...
  }
  Future<void> initPlatformState() async {
    if (!mounted) return;
    Push.onNotificationOpenedApp.listen(_onNotificationOpenedApp);
    var initialNotification = await Push.getInitialNotification();
    _onNotificationOpenedApp(initialNotification);
 }
  void _onNotificationOpenedApp(dynamic initialNotification) {
    print(initialNotification.toString());
  }

Thats response is like that :
{
result: {
extras: {
_push_cmd_type: "cosa",
_push_msgid: "-1744601771",
_push_notifyid: 1218295586,
KEY1: "VALUE1",
},
remoteMessage: {
Link: "null",
NotifyId: "0",
contents: "0",
ttl: "86400",
isDefaultSound: "true",
...
},
uriPage: "app://app2",
},
resultCode: "0",
}

You can use "Key-value pair" part so these values come from the extras part

Could you please share JSON sample for this request?

from hms-flutter-plugin.

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.