OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

[HMS] unable to process background notification

Open KKChong opened this issue 2 years ago • 4 comments

Description:

rawPayload='{"custom":"{"i":"a39d821c-19d9-47cf-9269-721975e8739e","a":{"foo":"bar"}}","alert":"English Message","title":"English Title","hms.sent_time":"0","hms.ttl":"0"}

the ttl value and sent_time value are 0, The default value should be 259,200 seconds (3 days) instead of 0 but GMS is working as expected value = 259,200

below is my request json: { "app_id": "c4709073-4aca-4930-bd9a-1605e65c8531", "include_player_ids": ["373d07ca-44d9-4b8b-8fa7-66b3920c462c"], "huawei_msg_type": "data", "data": {"foo": "bar"}, "headings": {"en": "English Title"}, "contents": {"en": "English Message"} }

Environment target SDK = 30 OneSignal SDK = 4.6.3 Huawei Push SDK = 6.1.0.300

KKChong avatar Dec 10 '21 09:12 KKChong

@KKChong Thanks for reporting. If you manually set a TTL (can you test via the dashboard AND the Notification Create REST API) does it correctly show it in the hms.ttl field on the device?

  • This will narrow the issue down if it is a defaulting issue or a payload assigning issue.

On hms.sent_time, it seems the OneSignal backend does not currently add this value to the payload, however it should be informational only.

jkasten2 avatar Dec 13 '21 23:12 jkasten2

Hi @jkasten2 , i have tried to manually set ttl to 2419200, but still got the hms.ttl = 0 as below:

Saving Notification job: OSNotificationGenerationJob{jsonPayload={"custom":"{"i":"95ac3b4e-a75f-4f13-a1c1-72b5d13d880c","a":{"foo":"bar"}}","alert":"English Message","title":"English Title","hms.sent_time":"0","hms.ttl":"0"}, isRestoring=false, shownTimeStamp=1639448521, overriddenBodyFromExtender=null, overriddenTitleFromExtender=null, overriddenSound=null, overriddenFlags=null, orgFlags=null, orgSound=null, notification=OSNotification{notificationExtender=null, groupedNotifications=null, androidNotificationId=-1, notificationId='95ac3b4e-a75f-4f13-a1c1-72b5d13d880c', templateName='', templateId='', title='English Title', body='English Message', additionalData={"foo":"bar"}, smallIcon='null', largeIcon='null', bigPicture='null', smallIconAccentColor='null', launchURL='null', sound='null', ledColor='null', lockScreenVisibility=1, groupKey='null', groupMessage='null', actionButtons=null, fromProjectNumber='null', backgroundImageLayout=null, collapseId='null', priority=0, rawPayload='{"custom":"{"i":"95ac3b4e-a75f-4f13-a1c1-72b5d13d880c","a":{"foo":"bar"}}","alert":"English Message","title":"English Title","hms.sent_time":"0","hms.ttl":"0"}'}}

My Sample REST Request: image

And i have tried to debug, due to ttl = 0, the code cant execute the NotificationBundleProcessor.processJobForDisplay(this, fromBackgroundLogic);

image

KKChong avatar Dec 14 '21 02:12 KKChong

@KKChong Just a quick follow up, we are falling back to defaults if these values are not in PR #1531. This will address the side effects you are seeing due to this value being 0.

jkasten2 avatar Feb 11 '22 23:02 jkasten2

Hi @KKChong,

We made ttl fixes in https://github.com/OneSignal/OneSignal-Android-SDK/pull/1528 and https://github.com/OneSignal/OneSignal-Android-SDK/pull/1531. Checking in if your issue is resolved?

nan-li avatar Jun 24 '22 21:06 nan-li