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

Native Development

Reply
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T
Accepted Solution

Set device wallpaper with API

I am trying to set device wallpaper, however, i keep getting errors when using the API

 

I have been following this documentation, regarding setting the device wallpaper:

https://developer.blackberry.com/cascades/reference/bb__platform__homescreen.html#setwallpaper

 

I am downloading an image from the internet, saving it to device, and then trying to set it as wallpaper. Here is where I set as wallpaper.

bb::platform::HomeScreen homeScreen;
bool result = homeScreen.setWallpaper(QUrl("file:///accounts/1000/shared/photos/myWallpaperFile.jpg"));

 

It gives me a couple errors. The first line shows

"undefined reference to `bb::smileytongue:latform::HomeScreen::HomeScreen(QObject*)'"

 

and the 2nd line shows
"undefined reference to `bb::smileytongue:latform::HomeScreen::setWallpaper(QUrl const&)'"

 

I am mimicking the documentation exactly, however it still gives me error. I tried cleaning project and all. I also made sure to add

#include <bb/platform/HomeScreen>

 

Not sure what to do. Any help would be appreciated.

 

Thanks!

Please use plain text.
Contributor
cocoalabs
Posts: 11
Registered: ‎05-07-2012
My Device: Blackberry 10 Alpha Device - Blacbkerry 9830
My Carrier: Verizon

Re: Set device wallpaper with API

Hi, did you ensure to add the library to your .pro file?

i.e. LIBS += -lbbplatform

You have to make sure you link to it. also you have to add the Library dependency in Momentics. With the root of the project selected do the following:

i'm on a mac so do the equiv. if you're on another platform: SHIFT-CMD-L

Then choose "Standard Blackberry platform Library" add "Blackberry Application Platform" if not already selected.

 

Good luck!

 

Lemont Washington

@cocoalabs

 

Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: Set device wallpaper with API

Thank you so much!!

 

I just had to add "LIBS += -lbbplatform" to the pro file and it worked. Noob mistake...

 

 

Please use plain text.
Contributor
cocoalabs
Posts: 11
Registered: ‎05-07-2012
My Device: Blackberry 10 Alpha Device - Blacbkerry 9830
My Carrier: Verizon

Re: Set device wallpaper with API

glat to be of help! im a new too (to bb10) pay it forward! :smileywink:

Please use plain text.