Is there application life cycle for web app Tizen smart TV ?

Tizen TV | Technical | thanh vu | 1 month | 19 Replies | 1,297 Views

*

thanh vu

  • *
  • 1
  • 110 Points
    • View Website
Is there application life cycle for web app Tizen smart TV ?
« On:August 15, 2019, 03:00:22 PM »
During developing the app for Tizen smart TV using web app with Angurlar JS, the face some problems which is related to push API.

1. Tizen Emulator cannot received push message, so I can only testing on the real TV. How to test push notification on Tizen Emulator?
2. When our app is hidden due to another app is running, I push the following message to the TV:

{
  "regID": "02a1f0f03e535551442988dc92bb0171803e4aa85748dc704ab2c6bf30746dcc25b99e0371ca79cfb8279067fc7bb52a0060",
  "requestID": "0000003",
  "sender": "FPT Telecom",
  "type": 0,
  "message": "setAutoRemove=true&textTypeButton1=OK&eventTypeClickOnButton1=test,ok&eventTypeClickOnIcon=test,icon&eventTypeClickOnThumbnail=test,thumbnail&badgeOption=INCREASE&badgeNumber=1&action=ALERT&alertMessage=Nội dung tin nhắn &textTypeTitle=Đã đến giờ phát chương trình&textTypeContent=<b>LiveShow</b> <i>Mỹ</i> <u>Tâm</u> - Trắng Đen (Liveshow HeartBeat)&imageTypeIcon=i_39p.png&imageTypeIconForIndicator=i_39p.png&imageTypeThumbnail=i_39p.png&imageTypeIconSub=i_39p.png&imageTypeBackground=i_39p.png&soundTypeUserData=test.wav&setDisplayApplist=notificationTray|ticker|lock|indicator|active|all&lyNotiEventSingle=true&textTypeContentForDisplayOptionIsOff=contentoptionoff& textTypeEventCount=34&textTypeInfo1=Testnotification&setTime=true&setTimeToText=true",
  "appData": "appId=24&itemId=100067958",
  "sessionInfo": "002002",
  "timeStamp": 1234567890
}

Then the notification show, I press OK, then our app is shown a few seconds (from previous state, like before it was hidden), then it is re-openned from the beginning. So I have a question, how can I open our app without re-openned?
Is there any document about app life cycle for web app for TIZEN smart TV? Like Android app (https://developer.android.com/guide/components/activities/activity-lifecycle)?

And it seems the sample code does work as expectation:
- the block of code "if (requestedAppControl.data.key === 'http://tizen.org/appcontrol/data/push/launch_type')" never be excuted.
- tizen.push.getPushMessage() always return NULL in the block of code: requestedAppControl.data.key  === 'test'.


My code:


// Defines the connect success callback
         function notificationCallback(noti) {
                         console.log('[Push service]: [1] >>>>>>>>>>>>>>>>>>>>>> notificationCallback <<<<<<<<<<<<<<<<<<<<<<<<<<');
                         console.log('[Push service]:  notification received on ' + noti.date + ' from: ' + noti.sender);
                         console.log('[Push service]: Details:');
                         console.log('[Push service]:  - data: ' + noti.appData);
                         console.log('[Push service]:  - alert message: ' + noti.alertMessage);
                         console.log('[Push service]:  - message: ' + noti.message);
                         console.log('[Push service]:  - session: ' + noti.sessionInfo);
                         console.log('[Push service]:  - request ID: ' + noti.requestId);
         }
     
         /* Connect to push service */
         tizen.push.connect(stateChangeCallback, notificationCallback, errorCallback);

    function getNoti(){
        /* Handling a Launch by the Push Service */
        var requestedAppControl = tizen.application.getCurrentApplication().getRequestedAppControl().appControl;
       
        console.log('[Push service]: appAC: ' + JSON.stringify(requestedAppControl));
        for (var i = 0; i < requestedAppControl.data.length; ++i) {
            console.log('[Push service]: requestedAppControl.data['+ i + '].key: ' + requestedAppControl.data.key + ", value: " +  requestedAppControl.data.value);
            if (requestedAppControl.data.key === 'http://tizen.org/appcontrol/data/push/launch_type') {
                /* Launch type is 'registration_change' or 'notification' */
                var appData = requestedAppControl.data.value[0];
                console.log('[Push service]: launch_type: ' + appData);
                if (appData === 'registration_change') {
                    /* Launched due to change in the registration state */
                } else if (appData === 'notification') {
                    console.log('[Push service]: Launched due to a notification.');
                    /* Launched due to a notification */
                    try {
                        /* Retrieve the latest message */
                        var pushMessage = tizen.push.getPushMessage();
                        /* Handle the retrieved message */

                        if (pushMessage) {
                            console.log('[Push service]: [2] >>>>>>>>>>>>>>>>>>>>>>> appdata = notification, received on ' + pushMessage.date + ' from: ' + pushMessage.sender);
                           console.log('[Push service]: Details:');
                            console.log('[Push service]:  - data: ' + pushMessage.appData);
                            console.log('[Push service]:  - alert message: ' + pushMessage.alertMessage);
                            console.log('[Push service]:  - message: ' + pushMessage.message);
                            console.log('[Push service]:  - session: ' + pushMessage.sessionInfo);
                            console.log('[Push service]:  - request ID: ' + pushMessage.requestId);
                            console.log('[Push service]:  - type: ' + pushMessage.type);
                        }else{
                            console.log('[Push service]: [2] >>>>>>>>>>>>>>>>>>>>>>> NULL');
                        }

                    } catch (error) {
                        console.log(error.name + ': ' + error.message);
                    }
                }
            }else if (requestedAppControl.data.key  === 'test') {
               
                console.log(requestedAppControl.data);
                var value = requestedAppControl.data.value[0];
                console.log('[Push service]: [3] >>>>>>>>>>>>>>>>>>> test case <<<<<<<<<<<<<<<<<<<<<<<<<<: ' + value);
                if(value == 'ok'){
                    console.log('[Push service]: test case: OK');
                    openAppFromNoti = true;
                    tizen.push.getUnreadNotifications();
                    try {
                        /* Retrieve the latest message */
                        var pushMessage = tizen.push.getPushMessage();
                        /* Handle the retrieved message */
                        console.log(pushMessage);
                        if (pushMessage) {
                            console.log('[Push service]: [3] notification received on ' + pushMessage.date + ' from: ' + pushMessage.sender);
                            console.log('[Push service]: Details:');
                            console.log('[Push service]:  - data: ' + pushMessage.appData);
                            console.log('[Push service]:  - alert message: ' + pushMessage.alertMessage);
                            console.log('[Push service]:  - message: ' + pushMessage.message);
                            console.log('[Push service]:  - session: ' + pushMessage.sessionInfo);
                            console.log('[Push service]:  - request ID: ' + pushMessage.requestId);
                            console.log('[Push service]:  - type: ' + pushMessage.type);
                        }else{
                            console.log('[Push service]: [3] >>>>>>>>>>>>>>>>>>>>>>> NULL');
                        }

                    } catch (error) {
                        console.log(error.name + ': ' + error.message);
                    }
                }else if(value == 'cancel'){
                    console.log('[Push service]: test case: Cancel');
                }
            }
        }
         }



*

aquinodapaz2@gmail.com

  • *
  • 2
  • 130 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #1 On:August 19, 2019, 10:39:19 PM »
a vitoria

*

aquinodapaz2@gmail.com

  • *
  • 2
  • 130 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #2 On:August 19, 2019, 10:41:26 PM »
avitoria

*

******6171

  • *
  • 1
  • 105 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #3 On:August 19, 2019, 11:55:10 PM »
Dj Tir

*

asepisron45@gmail.com

  • *
  • 1
  • 105 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #4 On:August 20, 2019, 10:20:03 AM »
e

*

alexlogy@gmail.com

  • *
  • 18
  • 195 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #5 On:September 14, 2019, 12:09:09 PM »
singplay

*

alexlogy@gmail.com

  • *
  • 18
  • 195 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #6 On:September 14, 2019, 12:10:44 PM »
singplay

*

alexlogy@gmail.com

  • *
  • 18
  • 195 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #7 On:September 14, 2019, 04:29:05 PM »
singplay


*

alexlogy@gmail.com

  • *
  • 18
  • 195 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #9 On:September 14, 2019, 04:31:17 PM »
singplay

*

******3264

  • *
  • 1
  • 105 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #10 On:September 27, 2019, 02:08:05 PM »
hello

*

******8105

  • *
  • 6
  • 160 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #11 On:December 04, 2019, 08:46:35 PM »
Shere it

*

******8105

  • *
  • 6
  • 160 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #12 On:December 04, 2019, 08:47:24 PM »
shere it

*

******8139

  • *
  • 1
  • 105 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #13 On:December 12, 2019, 09:53:38 AM »
Dowlond song

*

manojshri960@gmail.com

  • *
  • 2
  • 110 Points
  • I Love Tizen
Re: Is there application life cycle for web app Tizen smart TV ?
« Reply #14 On:December 12, 2019, 05:43:08 PM »
hy

 


Facebook Comments




anything