Menu
Sites
Language

Changing Home and Lock Screen programmatically

This code shows how to change the Home Screen or Lock Screen of Tizen mobile programmatically using Tizen Web API. Your images must be saved in images folder in your project.
//config.xml
<tizen:privilege name="http://tizen.org/privilege/setting"/>

//index.html
 <div class="ui-page ui-page-active" id="main">
    <div class="ui-content">
	<button id="changeBtn">Change HomeScreen</button>
    </div>
 </div>

//main.js
  var changeBtn = document.querySelector('#changeBtn');

    changeBtn.addEventListener("click", function() {
       setLockscreenWallpaper();
    });
    
    
    function setLockscreenWallpaper() 
    { 
    	  var imagepath="images/home.jpeg";
          try 
          {
             tizen.systemsetting.setProperty("HOME_SCREEN",imagepath,successCB, errorCB);
        // Give LOCK_SCREEN for changing Lock Screen
          }
          catch (error)
          {
             console.log("Error: " + error);
          }
    }
    
    function successCB()
    {
       console.log("It's set");
    }
    
    function errorCB()
    {
       console.log("It's not set");
    }

Responses

4 Replies
Karanja Kiniaru

Hi Iqbal thanks for this.

Getting this error "Invalid parameter passed." after switching up abit to log the error as well

 function errorCB(ERROR)
    {
       console.log("It's not set" + ERROR);
    }

What could have changed?

Iqbal Hossain

hi Karanja Kiniaru

I have used a static path for the image. 

 var imagepath="images/home.jpeg";

That means you have to put a image named "home.jpeg" in images folder. 

Karanja Kiniaru

Hi @Iqbal Hossain,

Thanks for the response.

That's not it. I have toyed around quite abit with different images giving absolute paths in some cases with no luck.

Have you ran this lately and it works ok?

Iqbal Hossain
images

here images means images folder of filesystem. just put a image on that folder and try again.