语言

Menu
Sites
Language
Receiving push notifications on TV

Hello,
I'm developing  a TV Web application and I'm in a desperate need of implementing push notifications. Currently I can properly register to the Push Service I'm getting the regID. It starts with "05" so I have to post to Korean API (no idea why since I'm in Europe and I mentioned it in the API key request).  Then I use Postman to send a notification to my app. Here is a screenshot of a sample request I tested.

In hearders I include the appID (from config.xml), appSecret (the code I got as a response to Push Service request email) and Content-Type: application/json.

The problem is that when I send a notification nothing is recieved in the app. This is the code that is responsible for handling the upcoming notification:

I've also tried making the notificationCallback function to take one parameter (like notificationCallback (response) {...} ) but to no avail. The console.log is not executing. What am I doing wrong?

I would also like to know if it's possible to use Firebase Cloud Messaging in Tizen TV Web app as an alternative. I've tried to connect it to my app, but didn't succeed since I wasn't able to make the ServiceWorker work ( ;) ).

Also - if either Tizen Push Notifications or Firebase Cloud Messaging somehow start working in my app - is there a way to display them even if the app is in background? For example then somebody is watching TV and they get a notification telling that the app requires their attention.

 

These are the 3 questions I need to know the answers to. Please help :)

All the best,
Marcin

编辑者为: Inwebit 03 10月, 2018

响应

1 回复
Armaan-Ul- Islam

#1

- I expect your Target device runs on Tizen 3.0 or higher(not Tizen 2.4), as the code sample you have mentioned is applicable since Tizen 3.0.

- Add 'internet' privilege along with 'push' privilege in config.xml.

- Recheck the Pre-requisites section for push.

 

#2

I'm not sure if Firebase Cloud Messaging supports Tizen TV or not. But Tizen TV supports Service worker now, Run this Code Snippet on your TV device.

if ('serviceWorker' in navigator) 
    console.log('Service worker is Supported'); 
else 
    console.log('Service worker is not Supported'); 

 

#3

Check out the

Receiving Push Notifications section:

-When the application is running

-When the application is not running