I want to read the date field from payload of this push notification but the api doesn't seem to work :(
I'm now from hms Huawei, i have read this tutorial: HMS-Plugin-Guides-V1
all part is completed except d point, -> error of overwriting.
When i send a notification, and i push on it. All ok my app will open. But i can't read notification body.
In the log i see the notification service start -> take token and immediately kill itself... i don't understand where is problem.
Notify JSON
{
"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": "intent://eccc_ecc"
}
}
},
"token":-xxxxx"
]
}
}
My app code:
const App = () => {
HmsPushEvent.onTokenReceived(result => {
console.log('Push token', result.token);
});
HmsPushEvent.onRemoteMessageReceived(event => {
console.log('Data message received');
const RNRemoteMessageObj = new RNRemoteMessage(event.msg);
const msg = RNRemoteMessageObj.parseMsgAllAttribute(event.msg);
console.log('Data message received : ' + msg);
});
return (
<SafeAreaView>
<Text>Testing Text</Text>
</SafeAreaView>
);
};
Manifest (only application section, other line is standard for any android app):
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data
android:name="push_kit_auto_init_enabled"
android:value="true" />
</application>
this is 'condensed' log:
16:23:53.989 HMSSDK_HmsMessageService: start to bind 16:23:54.032 HMSSDK_HmsMessageService: handle message start 16:23:54.036 HMSSDK_HmsMessageService: onNewToken 16:23:54.043 HMSSDK_HmsMessageService: doOnNewToken:transactionId = null , internalCode = 0,subjectId:null,proxyType:null 16:23:54.046 HMSSDK_HmsMessageService: Apply token OnNewToken, subId: null 16:23:54.179 HMSSDK_HmsMessageService: onNewToken to host app. 16:23:54.215 HMSSDK_HmsMessageService: onNewToken to host app with bundle. 16:23:54.222 HMSSDK_HmsMessageService: start to destroy