Reputation: 211
I am developing a TV app for LG 4K TVs in webOS 3.0.
self_evaluation_checklist_3.4.xlsx lists a requirement for Exit button behavior as below.
"For webOS 3.0, pressing the EXIT button the app is completely closed and does not remain on the Recent list."
I have been searching but I haven't had any luck finding the API call to close the app completely and also removes the app from the Recent list.
All I could find is webOS.platformBack(); but that only takes back to the Home screen of the TV and doesn't close the app.
How can I close the app completely and don't list the app in the Recent list?
Upvotes: 2
Views: 14623
Reputation: 19203
To exit the app and leave it in the Recent list I used the following:
const APPLICATION_MANAGER_SERVICE = 'luna://com.webos.applicationManager';
const TV_APP_ID = 'com.webos.app.livetv';
function sendAppToBackground() {
webOS.service.request(APPLICATION_MANAGER_SERVICE, {
method: 'launch',
parameters: { id: TV_APP_ID },
onSuccess(response) {
if (response.returnValue === false) {
console.error(`Error sending Application to background and bringing TV Application with ID ${TV_APP_ID} to the foreground.`);
forciblyExitApp();
}
},
onFailure(error) {
console.error(error);
forciblyExitApp();
},
});
}
function forciblyExitApp() {
window.close();
}
Upvotes: 1
Reputation: 145
This is correct method ( webOS.platformBack(); ). At least our app uses the same method for all 3 generations of WebOS and has never been declined by LG QA Center for this.
Upvotes: 1