Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Philipk
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
Accepted Solution

setWallpaper with Base64?

Trying to set wallpaper with a Base64 image. 

 

Doesn't seem to working has anyone gotten this to work? Or know a reason why it wouldn't?

_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: setWallpaper with Base64?

It only accepts a file path so the code will be looking for a file called [base64-encoded-image]




Click the like button if you find my posts useful!
Developer
Philipk
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook

Re: setWallpaper with Base64?

I guess the only way to do this would be saving the image to the system and then setting the wallpaper from that image.
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: setWallpaper with Base64?

I was thinking about this as well when I made my original reply

 

There are two paths I can see..

 

1) Write to system (requires a server so pointless)

 

2) Get them to rewrite a tiny bit of WebWorks so we can use a data URL

 

Looking at option (2) - it makes a lot of sense without hurting existing code

 

You could just make the 2nd var optional so it's be ...

 

setWallpaper(filename, [optonal] coding)

 

If coding is not supplied you get filename

 

If you think about it this is damned useful cos you can optionally JSON in Philipk's idea

 

How do we un-solve?

 

This is a really good API Q




Click the like button if you find my posts useful!
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: setWallpaper with Base64?

I've had a little more change to look at this today as I've been working on a similar issue myself

 

It is possible to take a Base64 via AJAX and write to FS

 

Yes - I know it's not ideal but it works

 

You need to look at the Playbook file and dir APIs to get a handle on this

 

It don't work in Ripple for me (so I keep signing and installing)

 

Also this is PB only for now

 

What you, basically, need to do is translate some code you insert into [whatever] into a file location as far as I see it

 

I have not worked all the issues out yet but I'm gonna nag them @ Amsterdam over these issues




Click the like button if you find my posts useful!
Developer
Philipk
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook

Re: setWallpaper with Base64?

You'll have to show me that in Amsterdam.

_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: setWallpaper with Base64?

Will do - PM me to set up a meet - I've got a full schedule but can always skip one of the less important ones

 

 

I can see how to do it but it's rather messy

 

There appears to be a bit of a problem with what is addressable from an app

 

These things are get-around-able

 

Personally I want to write a HTML file then load that into the app - not as easy as it sounds but also fixable via JavaScript + bb calls

 

In your particular case things should be easier

 

As I see it you need some Server JSON delivery of the base64 encoded image, you then store that in app data-space so you've got a physical file you can load back in

 

There are a few techie issues in this area as well - but again I need a chat with a techie

 




Click the like button if you find my posts useful!
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: setWallpaper with Base64?

Hi Phil

 

I've worked out the messy workaround

 

1) First off you want to get the home property from https://developer.blackberry.com/html5/apis/blackberry.io.html

 

2) Next you want to download an image file from a server https://developer.blackberry.com/html5/apis/blackberry.io.filetransfer.html saving it into home picked up in step (1)

 

3) Finally you can use setWallPaper to load the file you saved in (2)

 

That's the basics and in no way whatsoever involved base64 :smileysad:

 

There are HTML5 directory finctions that would allow you to select which wallpaper to load but personally I'd use localStorage or something to keep a list of images available on the device

 

Not the answer to the Q, just another way to do it




Click the like button if you find my posts useful!
Developer
Philipk
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook

Re: setWallpaper with Base64?

Thanks,

No matter how I decide to do it I will definitely need to use the file transfer method.

Was good seeing you in Amsterdam.
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: setWallpaper with Base64?

Rats

 

blackberry.io.filetransfer.download() doesn't work - or at least not with image files (files are always too small)

 

JSON it is then :smileysad:

 

It's going to need mod_rewrite to be seamless

 

Think I'll play with that tomorrow...

 

My thing is the reverse of yours - I wanna store in my data area then drag it out and show the image (not possible without work-arounds owing to FS Security)

 

I'm trying to get an image from [somewhere] to app data then convert it to base64 to circumvent FS restrictions




Click the like button if you find my posts useful!