Search code examples
androidpush-notificationhuawei-mobile-serviceshuawei-developershuawei-push-notification

Huawei Push Kit API - get Push Id from rest Api


I am trying to send notifications to my android app via HMS push with Rest api.

The system works, but I can't find an api to find the Push Id (Token).

{
    "validate_only": false,
    "message": {
        "notification": {
            "title": "Notifica simpatica",
            "body": "Io sono il body della notifica simpatica",
            "notify_icon": "https://res.vmallres.com/pimages//common/config/logo/SXppnESYv4K11DBxDFc2.png"
        },
        "data": "{'param1':'value1','param2':'value2'}",
        "android": {
            "collapse_key": -1,
            "urgency": "NORMAL",
            "category": "PLAY_VOICE",
            "ttl": "1448s",
            "fast_app_target": 1,
            "notification": {
                "click_action": {
                    "type": 1,
                    "intent": ""
                }
            }
        },
        "token": [
            "I NEED THIS"
        ]
    }
}

I have read about a push subscription api for get it but after two days i don't find nothing :(

Please help me! Thanks!


Solution

  • PushToken can be received only from device. On device you should execute method for receiving it and then send this PushToken to your backend.