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
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Calling a function during splashscreen

 <splashScreens>
       <image>icon.png</image>
    </splashScreens>

 

 

I added splashscreen to my app, I want to know if I can during splashscreen run a function and how?

I want to call an API function, after api function over dismiss the splashscreen

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Calling a function during splashscreen

the splashscreen is displayed while the app initializes, you cannot run code during that process.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Calling a function during splashscreen

but i did this and it worked

 

qmlRegisterType("com.devpda.tools", 1, 0, "MyTimer");
 QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); 
 if (!qml->hasErrors()) {
                qDebug() << "casting and storing NavigationPane";
                myNavi = dynamic_cast<NavigationPane*>(root);
                qml->setContextProperty("quoteApp", this);
            }
    qDebug() << "before splah over function calls";

 

 

main.qml bineng the splashscreen

 

import bb.cascades 1.2
import com.devpda.tools 1.0

NavigationPane{
    id: nav
    objectName: "myNavi"
    onCreationCompleted: {
        timer.start()
    }
    
    Splash {
        id: splash
    }
    
    attachedObjects: [
        MyTimer{
            id: timer
            interval: 10000
            onTimeout: {
                nav.remove(splash)
                nav.push(main.createObject())
                stop()
            }
        },
        ComponentDefinition {
            id: main
            source: "firstpage.qml"
        }
    ]     
}

 

 

during those 10 seconds, the debug was printed.

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Calling a function during splashscreen

the normal approach is to create your own splash screen (see for example Plants vs Zombies, or Jetpack Joyride)

 

Don't show your main screen at startup, show a screen which looks exactly like your splash screen.

call whatever code you want

and when you are finished, dismiss your fake splashscreen and show your main screen normally

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Highlighted
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Calling a function during splashscreen

displaying your own (splash) screen is something else. you posted the bar descriptor splash code, and this is displayed while the app initializes.

if you want to display a custom splash screen when the app is launched that is entirely up to you, but if it is possible it should be avoided.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter