Development for BlackBerry 10. Getting Started

The BlackBerry 10 platform has been attracting attention for quite some time. The solution from RIM was quite interesting, so why not try your hand at this field.
Today we will try to run a simple application for BB 10 in the simulator and look at this miracle.

A little bit about the birds


Cascades is one of the main application development tools for BB. It is part of The BlackBerry 10 Native SDK and is designed to create a graphical interface. This beast is based on Qt and QML, supports 2D and 3D effects, animation. It also allows you to create your own elements based on existing ones. To demonstrate the simplicity of developing UIs in Cascades, we ’ll give an example of creating a clickable button using QML and C ++.

Rotary button in QML:
import bb.cascades 1.0
Page {
    content: Button {
        id: rotatingButton
        text: "My Rotating Button"
        animations: [
            RotateTransition {           
                id: rotButton
                toAngleZ: 360
                duration: 350
            }
        ]
        onClicked: {
            rotButton.play();
        }
    }
}


Rotary button in C ++:
// Create the root page and the button
Page* root = new Page;
Button* myButton = Button::create("My Rotating Button");
// Create a rotation animation and associate it with the button
RotateTransition* rotation = RotateTransition::create(myButton)
                              .toAngleZ(360)
                              .duration(350);
// Connect the button's clicked() signal to the animation's play() slot, so that
// when the button is clicked, the animation plays. Make sure to test the return
// value to detect any errors.
bool res = QObject::connect(myButton, SIGNAL(clicked()), rotation, SLOT(play()));
Q_ASSERT(res);
// Indicate that the variable res isn't used in the rest of the app, to prevent
// a compiler warning
Q_UNUSED(res);
// Set the content of the page and display it
root->setContent(myButton);
app->setScene(root);


Let's start


To begin with, we need to stock up on a tool box:

In addition, you need to get the keys here and fill out the form. Be sure to remember or write down your PIN, it will still be useful to you.
It looks like a form

After some time, the keys will come to you by e-mail.

Now:
  1. Install the SDK , (VMware player) and Simulator following the instructions;
  2. We start VMware palyer ;
  3. Select the item "Open a Virtual Machine" ;
  4. We find the file "BlackBerry10Simulator" in the folder with the installed simulator and click "Open" ;
  5. Select a simulator from the list and click "Play virtual machine" ;

Simulator launch





A bit of shamanism


Before you begin, configure the simulator:
  1. We are looking for settings;
  2. In the settings, select the item “Security and Privacy” ;
    Hidden text
  3. There we find "Development Mode" ;
    Hidden text
  4. Check that it was turned on (if not, then it must be turned on);
    Hidden text


Let's create


  1. First, launch the BlackBerry Native SDK .
    This is the most common Eclipse with its whistles;
  2. Create a new project and select “BlackBerry Cascades C ++ Project from SDK Samples” .
    Like this;
  3. Now we need to select the application template.
    For example this;
  4. Give him a name and select an icon;
  5. We get into the Deployment Setup Wizard and click Next ;
  6. Now you need to install the device.
    If the simulator is turned on, the device is detected automatically.

    If not, copy the ip address yourself.
    It can be seen in the lower-left part of the simulator (highlighted in red);
  7. Next, add the keys (they must come by mail, after sending the registration form).
    Select the first item and click Next.

    We indicate the path to the keys, PIN (which you indicated when filling out the form) and password, as in the example under the spoiler.
    Example

    We will be asked about the backup keys and certificate. You can skip this item (and configure it later if you wish);
  8. This completes the work with the wizard, it remains to click “Finish” ;
  9. Still need to configure the build. To do this, right-click on the project and select Build Configurations-> Set Active-> Simulator-Debug ;
    Hidden text
  10. It remains only to assemble the project (RMB for the project and the Build Project );
  11. And run (RMB on the project and Run As-> BlackBerry C / C ++ Application );


That's all.
Result


PS Write your reviews about the article and report in a personal error.

Also popular now: