如果tizen Web应用程序处于后台并且推送通知出现,则4.0.0.7 tizen更新后,应用程序将重新启动

时间:2020-07-29 10:40:00

标签: tizen tizen-web-app

以下是用于接收通知的代码段:

function register(){
        
    function registerSuccessCallback(registrationId) 
    {
        // once get registration id sending to server.
        // We are getting registration id every time we don't have any problem here.
    }
    function errorCallback(response) 
    {
        
    }
    function stateChangeCallback(state) {           
        if (state == 'UNREGISTERED') {          
            tizen.push.register(registerSuccessCallback, errorCallback);                
        }
    }
    function notificationCallback(noti) {           
        function onsuccess(){
            
        }           
        var msg=noti.alertMessage;
        // If application in foreground then control comes here.
        // If application in background then control not coming here. Instead application gets restarted in tizen version 4.0.0.7
    }
        
    var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");
    tizen.push.connect(stateChangeCallback, notificationCallback, errorCallback);   
    tizen.push.register(registerSuccessCallback, errorCallback);
    
}

从服务器发送推送通知

{
   "regID":"<Correct registration id>",
   "requestID":"150bca2f3e9-39cb-4887-b3ab-61440770c5ed1596005116555",
   "sender":"App",
   "type":0,
   "message":"action=LAUNCH&alertMessage=NewMessage",
   "appData":"{userId:880}"
}

当应用程序处于前台时,推送通知控件将在新(4.0.0.7)和旧(4.0.0.4)tizen版本的notificationCallback()中正确出现。 当应用程序在后台运行时,推送通知控件未正确传入new(4.0.0.7)中的notificationCallback()中,而是每次推送通知时 来观看,应用程序将重新启动。仅在新的(4.0.0.7)tizen更新中会发生这种情况。

如果使用旧版(4.0.0.4)tizen版本,则如果应用程序在后台运行并且推送通知到来,则无需重新启动应用程序即可正确调用notificationCallback()。

那么,为什么要在新(4.0.0.7)tizen版本中重新启动应用程序?

0 个答案:

没有答案
相关问题