Nitin tiwari
Nitin tiwari

Reputation: 690

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

Upvotes: 1

Views: 1109

Answers (1)

djus22
djus22

Reputation: 21

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);

Upvotes: 2

Related Questions