Languages

Menu
Sites
Language
Image uri for wallpaper

Hello everyone!

I'm having trouble developing the wallpaper app
I have a picture with a path like this: /opt/usr/apps/**appid**/res/wgt/home_screen.jpg
That path can not be set as wallpaper
I want to copy it to "/Device storage/Images/"
Can anyone help me?

Thanks everyone!

Responses

9 Replies
Paul L

native or web development? Why cannot you set this as wallpaper?

nathan

Web development, perhaps because the path is private.

Paul L

see this link and access permissions to app dirs: 

https://developer.tizen.org/development/training/native-application/understanding-tizen-programming/file-system-directory-hierarchy

nathan

Thank Paul L!

I used the solution create image from base64

Shaswati Saha

Would you please share the way you followed? Did you try this way?

nathan

Shaswati Saha!

I follow this tutorial

https://developer.tizen.org/community/code-snippet/web-code-snippet/save-canvas-image-device-memory

Marco Buettner

You can use filesystem api and the "copyTo"-function

var toDir = "images",
    filename = "home_screen.jpg",
    appLocation = "wgt-package",
    workDir;

function onError(err) {
    alert(err.name);
}

function onSuccess() {
    alert('file copied');
}

function onListing(files) {
    var i = 0;
    
    for(i; i < files.length; i++) {
        if(files[i].name === filename) {
            workDir.copyTo(files[i].fullPath, toDir, false, onSuccess, onError);
        }
    }
}

function onResolve(dir) {
    workDir = dir;
    dir.listFiles(onListing, onError);
}

tizen.filesystem.resolve(appLocation, onResolve, onError, 'rw');

 

 

nathan

I can not use tizen.filesystem.resolve with appLocation path (/opt/usr/apps/**appid**/res/wgt/)
Maybe i'm wrong?

nathan

I replaced 'rw' to 'r' and succeeded

thanks!