Introduction to the BlackBerry Native SDK

  • 3,986 views
Uploaded on

This presentation provides an introduction to the BlackBerry® PlayBook™ Native SDK and how to build a sample application. Topics explored include where and what comes in the SDK, how apps are …

This presentation provides an introduction to the BlackBerry® PlayBook™ Native SDK and how to build a sample application. Topics explored include where and what comes in the SDK, how apps are packaged, what goes into a small app, and a tutorial for building a sample.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,986
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Introduction to the BlackBerryPlayBook Native SDK: Buildinga Sample ApplicationNick Landry, David CummingsDEV319February 7-8, 2012
  • 2. Belligerent Blocks(github.com/blackberry/NDK-Samples)What can you do in a few weeks?
  • 3. Belligerent Blocks• Graphics• Sound• Touch events• Pause/Resume• Scoreloop Leaderboard• Local leaderboard (if offline)
  • 4. Agenda Where to get the SDK What comes in the SDK How are apps packaged What goes into a small app Belligerent Blocks The next steps… 4
  • 5. Where to get the SDK http://developer.blackberry.com/native/download Look for this! 5
  • 6. Agenda Where to get the SDK What comes in the SDK How are apps packaged What goes into a small app Belligerent Blocks The next steps… 6
  • 7. What comes in the SDK?Tools IDE Compiler tool-chain Deployment utilitiesPlatform Headers and Libraries 7
  • 8. The IDEWhat comes in the SDK An Eclipse® based IDE Debugger Easy device deployment Create signed release builds Built-in profiling tools 8
  • 9. Command-Line ToolsWhat comes in the SDK MinGW (on Windows®) with Make GCC based tool-chain blackberry-nativepackager: package an app blackberry-deploy: put a packaged app onto the device blackberry-connect: allow ssh access to the device blackberry-signer: sign a packaged app 9
  • 10. LibrariesWhat comes in the SDK QNX® provided POSIX headers and library SQLite3® database engine Freetype2 for fonts 10
  • 11. Open GL ES and EGLWhat comes in the SDK Standard embedded graphics stack Similar to every other mobile platform Libscreen is the native window API 11
  • 12. OpenALWhat comes in the SDK Sound library available on different platforms Play sound effects Play looping background music See Belligerent Blocks Sound.cpp and Sound.h 12
  • 13. BPSWhat comes in the SDK BlackBerry® Platform Services The app’s event queue Window state events Accelerometer,dialogs,geolocation,etc. 13
  • 14. ScoreloopWhat comes in the SDK For NDK 1.0, go to http://blackberry.com/beta Included in NDK 2.0 betas Adds social features to games Leaderboards, challenges, achievements, and more 14
  • 15. The Big Picture Cascades Application Native Application Gaming & Porting Developers Developers Developers C++ UI framework NDK 1.0 (following Qt idioms) Cascades NDK 2.0 Application Infrastructure & Platform API (C++)C++ platform APIs and Qt Qt Libraries Wide range of APIs Meta Plat. (C/C++) Core C APIs: QNX, BPS, Graphics, etc. Platform API ( C ) 15 15
  • 16. Agenda Where to get the SDK What comes in the SDK How are apps packaged What goes into a small app Belligerent Blocks The next steps… 16
  • 17. Creating a BARHow are apps packaged Apps are installed from BlackBerry ARchives BAR file contains executable, images, music, etc. Created through IDE or command-line BAR BAR Files Descriptor 17
  • 18. BAR Descriptor File IDE creates basic bar-descriptor.xml Contains meta-data about the app Paths to files (assets) for BAR inclusion 18
  • 19. BAR Meta-DataHow are apps packed Name, package, author, version Icon (asset to use as an icon) Splashscreen (asset to use as a splashscreen) Set of permissions (run_native at a minimum) Entry-Point (the asset to execute on launch) 19
  • 20. Adding Read-Only AssetsHow are apps packagedInclude the asset:<asset path="Assets/splash.png">splash.png</asset>Deployed on PlayBook as:./app/native/splash.png (read-only)Now set splash.png as the splashscreen:<splashscreen>splash.png</splashscreen> 20
  • 21. Adding Read-Write AssetsHow are apps packagedInclude the asset:<asset path="Assets/scores.db">data/scores.db</asset>Deployed on BlackBerry PlayBook as:./app/native/data/scores.db (read-only)Now copy it to:./data/scores.db (read-write) 21
  • 22. Deploying BARsHow are apps packaged BARs are created in an unsigned state Unsigned BARs can be installed using a Debug Token RDK key used for releases PBDT key used to create debug tokens Go here to get both keys: http://developer.blackberry.com/native/signingkey 22
  • 23. Agenda Where to get the SDK What comes in the SDK How are apps packaged What goes into a small app Belligerent Blocks The next steps… 23
  • 24. Initial CodeSmall App Things to initialize and load  Graphics stack  BPS  Initialize app logic  Load assets Start app loop 24
  • 25. GraphicsSmall App Create libscreen context and window Create an EGL window surface Initialize OpenGL® for 2D rendering Tutorials on the developer native site 25
  • 26. Event LoopSmall Appwhile (true) { bps_get_event(&event, 0); if (event == NULL) { break; } if (bps_event_get_domain(event) == navigator_get_domain()) { switch(bps_event_get_code(event)) { case NAVIGATOR_EXIT: onExit(); break; } }} 26
  • 27. Agenda Where to get the SDK What comes in the SDK How are apps packaged What goes into a small app Belligerent Blocks The next steps… 27
  • 28. bbutilBelligerent Blocks bbutil.h, bbutil.c are seen in many samples Sample libscreen/EGL setup Orientation lock Orientation change handling Text rendering with GL ES 1.1 Loading textures with libpng 28
  • 29. Adding PhysicsBelligerent Blocks Box2D ported to BlackBerry Tablet OS Available through github.com/blackberry Latest version 2.2 is available Grab it from github, import into IDE 29
  • 30. Leaderboard Belligerent Blocks Uses Scoreloop if there is an internet connection Otherwise, uses local SQLite3 database 30
  • 31. Scoreloop IntegrationBelligerent Blocks// Event loop:bps_event_t* event;bps_get_event(&event, 0);if (PAL_HandleBPSEvent(&m_scoreloopInitData, event) == BPS_SUCCESS) { continue;}// Handle events.... 31
  • 32. Server-SideBelligerent Blocks 32
  • 33. Playing Belligerent Blocks 33
  • 34. Agenda Where to get the SDK What comes in the SDK How are apps packaged What goes into a minimal app Belligerent Blocks The next steps… 34
  • 35. Looking AheadNext Steps… Scoreloop API: moved into the NDK More BPS: Magnetometer, Gyroscope 2.0 Beta: http://developer.blackberry.com/native/beta Cascades: C++ UI framework 35
  • 36. The SamplesNext Steps…  Locking/defining starting orientation  Orientation change handling  Loading textures  Rendering text  Touchscreen / mouse input handling  Accelerometer  http://developer.blackberry.com/native/sampleapps 36
  • 37. More resources…Next Steps…http://developer.blackberry.com/native/documentation Tutorials Recipes Reference manualhttp://developer.blackberry.com/native Click on Support Forums 37
  • 38. Other Sessions…TuesdayDEV315 - Game Makers Dream: The BlackBerry PlayBook Native SDK (14:45)DEV340 - Lab: Introduction to the Native Development Kit (16:15)DEV337 - Introduction to the Cascades UI (17:30)WednesdayDEV385 - BlackBerry® 10 Application Anatomy (09:30)DEV341 - BlackBerry Native SDK for BlackBerry Tablet OS: Advanced Tooling (10:45)GRP304 - Collaboration Roundtable: Native App Development for BlackBerry Tablet OS (12:15)DEV340 - Lab: Introduction to the Native Development Kit (14:15) 38
  • 39. Ask the ExpertsTuesday14:45 – 15:45Wednesday09:30 – 10:3016:45 – 17:45 39
  • 40. One more time… http://developer.blackberry.com/native/download Look for this! 40
  • 41. THANK YOUNick Landry, David CummingsDEV319February 7-8, 2012