简体   繁体   中英

How to Launch Pervious Tizen app on exit of current Tizen app?

I have created a Tizen application and when i launch my Tizen app from the Samsung app menu on Samsung tv and after launching when I press return key i get back to the BroadCast menu instead if Samsung app menu . i am using below code to exit the app after confirmation pop up

App.exit = function() {
    if (confirm("Do you want to exit?")) {

        var isRemember = localStorage.getItem('remember');
        console.log("app-rem : " + isRemember);
        if (isRemember == 'false') {
            console.log("cleared");
            localStorage.clear();
            sessionStorage.clear();
        }
        tizen.application.getCurrentApplication().exit();

    }
};

i want when I launch my application from Samsung app menu and after launching if I exit my app it should open samsung menu instead of broadcasting menu

You can launch Samsung app menu manually by:

App.exit = function() {
    if (confirm("Do you want to exit?")) {

        var isRemember = localStorage.getItem('remember');
        console.log("app-rem : " + isRemember);
        if (isRemember == 'false') {
            console.log("cleared");
            localStorage.clear();
            sessionStorage.clear();
        }

        function onsuccess() {
          tizen.application.getCurrentApplication().exit();
        }

        tizen.application.launch("com.samsung.tv.store", onsuccess);

    }
};

Also you can try to use below code, but I am not sure that Samsung app menu is the caller of your Tizen app :

var currentApp = tizen.application.getCurrentApplication();
var callerAppId = currentApp.getRequestedAppControl().callerAppId;

function onsuccess() {
    tizen.application.getCurrentApplication().exit();
}

tizen.application.launch(callerAppId, onsuccess);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM