1. xsacha's Avatar
    I found it is quite easy to compile and test native apps directly on the Playbook. The Momentics IDE uses the qconn application on Playbook to debug applications.

    What?
    Using Momentics IDE you can, in one click, compile a C++ app, transfer to Playbook, run on Playbook, see console info and debug the application.

    Can I run the native app standalone on my Playbook?
    Yes, package it with blackberry-nativepackager and side-load. It will appear as an installed app.

    Can I use a graphical framework?
    Yes, link to libph. Playbook uses Photon.

    How?

    1. Run blackberry-connect to enable qconn on your Playbook. This enables SSH.
    2. Install Momentics 4.7 IDE for Windows. 30-day trial available here
    3. Create a new project. When creating your project choose armv7 as the target (debug/release). Click to go to the Workspace.
    4. Go to Run->Run Configurations and in the Main tab, Add New Target and put the IP address of your playbook in there. Then close.

    Now your Momentics IDE on Windows is set up to compile C++ applications and install directly to your Playbook. No signing/keys required. No transferring to your playbook and running.
    All the console output will be directly visible at the bottom of your IDE. Native app will run directly on your Playbook hardware.

    Enjoy!

    Which apps should we compile? Any useful simple (VLC is a bit hard) QNX apps?
    Last edited by xsacha; 08-19-11 at 10:51 PM.
    08-19-11 09:06 PM
  2. Shao128's Avatar
    This was posted a while ago, but its not going to easy to port anything over since there is no graphical framework ie QT, Photon etc... Also there is no way to run it on the device standalone.
    08-19-11 09:26 PM
  3. xsacha's Avatar
    I looked all over the internet and it seems no one had posted about it yet. The only method I can find online is adding execute prop in linux, zipping it and then sending zip to playbook and then ssh in to run it.
    Using Momentics IDE to directly execute on device is far simpler!

    Further, the Playbook uses photon. So yes, graphical apps are currently possible! I have already made a graphical native app.

    Porting Qt may be as simple as compiling for armv7 on latest stable qnx source. However, I haven't attempted it yet.

    Further, these native apps can run standalone. If you package with blackberry-nativepackager, they appear as an app in app list. This is actually required to use Photon.
    Last edited by xsacha; 08-19-11 at 10:45 PM.
    08-19-11 10:43 PM
  4. HaTaX's Avatar
    Well, if you're this far into it and would like to package up a native app as a bar file, here's an example app.xml file for you

    Code:
    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <qnx xmlns="http://www.qnx.com/schemas/application/1.0">
    
        <!-- BlackBerry Tablet OS application descriptor file.
    
            Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.
    
        -->
    
        <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
            Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
        <id></id>
    
        <!-- Used as the filename for the application. Required. -->
        <filename>MyNativeApp</filename>
    
        <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
            May have multiple values for each language. See samples or xsd schema file. Optional. -->
        <name>MyNativeApp</name>
    
        <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
            Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
            An updated version of application must have a versionNumber value higher than the previous version. Required. -->
        <versionNumber>1.0.0</versionNumber>
    
        <!-- Fourth digit segment of the package version. First three segments are taken from the
             <versionNumber> element.  Must be an integer from 0 to 2^16-1 -->
        <buildId>1</buildId>
    
        <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
        <!-- <versionLabel></versionLabel> -->
    
        <!-- Description, displayed in the BlackBerry Tablet OS application installer.
            May have multiple values for each language. See samples or xsd schema file. Optional. -->
        <!-- <description></description> -->
    
        <!-- Copyright information. Optional -->
        <!-- <copyright></copyright> -->
    
        <!--  Name of author which is used for signing. Must match the developer name of your development certificate. -->
        <!--author></author-->
        
    
        <!--  Unique author ID assigned by signing authority. Required if using debug tokens. -->
        <!--authorId></authorId-->
    
        <initialWindow>
            <systemChrome>none</systemChrome>
            <transparent>false</transparent>
            <autoOrients>false</autoOrients>
            <aspectRatio>landscape</aspectRatio>
        </initialWindow>
    
        <!--  The category where the application appears. Either core.games or core.media. -->
        <category></category>
    
        <!--  The icon for the application, which should be 86x86. -->
        <icon>
            <image>icon.png</image>
        </icon>
    
        <!--  The splash screen that will appear when your application is launching. Should be 1024x600. -->
        <splashscreen>splash.png</splashscreen>
    
        <!-- Request permission to execute native code.  Required for native applications. -->
        <permission system="true">run_native</permission>
    
        <!--  The permissions requested by your application. -->
        <!--  <permission>access_shared</permission> -->
        <!--  <permission>record_audio</permission> -->
        <!--  <permission>read_geolocation</permission> -->
        <!--  <permission>use_camera</permission> -->
        <!--  <permission>access_internet</permission> -->
        <!--  <permission>play_audio</permission> -->
        <!--  <permission>post_notification</permission> -->
        <!--  <permission>set_audio_volume</permission> -->
        <!--  <permission>access_bbid_pii</permission> -->
        <!--  <permission>access_bbid_authenticate</permission> -->
        <!--  <permission>read_device_identifying_information</permission> -->
    
    </qnx>
    Pretty similar to the xml files used by AIR and WebWorks, just a few different things here and there.

    Truthfully I'm just posting this as a template, you've already got enough information to get it loaded as a bar file if you've figured out that photon is inaccessible unless you go through the userland desktop system. Good sleuthing!

    Want to post up your binary so those of us that like to tinker can take it for a run? I know it's probably proof of concept, but I'm sure you'd get some attention for it.
    Last edited by HaTaX; 08-19-11 at 11:33 PM.
    08-19-11 11:28 PM
  5. xsacha's Avatar
    Thanks HaTaX.
    I've been using the android_player setup as a template with nativepackager. Is there any other native apps with .bar files available?

    Android Player has a Photon launcher. You can reverse engineer (IDA Pro) it to see all the calls it makes and set up your project the same way in Momentics. To aid IDA Pro, you can get all the libraries from /base/usb/lib.

    Momentics has all the headers available for things like Photon.
    #include <Pt.h>

    I will try to get a nice source package together for tinkering after work. I'd like to get a script for automatic (debug token) packaging first.
    If you modify that new "Blackberry Tablet OS Graphical Aid" to use nativepackager, that would probably suffice. Or a batch script.
    Last edited by xsacha; 08-20-11 at 12:20 AM.
    08-20-11 12:03 AM
  6. HaTaX's Avatar
    I will try to get a nice source package together for tinkering after work. I'd like to get a script for automatic (debug token) packaging first.
    If you modify that new "Blackberry Tablet OS Graphical Aid" to use nativepackager, that would probably suffice. Or a batch script.
    There's a "blackberry-nativepackager" (Not a batch file) in the same directory, this is the script for OSX / linux and should work as a basis for what you'd like to do.
    Code:
    #!/bin/sh
    here=$(dirname "$0")
    LIB="$here/../lib"
    java -Xmx512M -cp "$LIB/EccpressoJDK15ECC.jar:$LIB/EccpressoAll.jar:$LIB/BarSigner.jar:$LIB/BarDeploy.jar:$LIB/BarAir.jar:$LIB/BarPackager.jar" com.qnx.bbt.nativepackager.BarNativePackager "$@"
    Very resourceful on running android_launcher through IDA as well. I'm wondering how many other apps are using a launcher similar to the Android player for native code, and by similar I really mean the same. It looks rather generic besides the hard coded references.

    Glad to know there's someone else spending time looking at this side of the PB, there's quite a bit of opportunity here...

    Also, DeadSpace was built using the NDK, along with Need for Speed and Tetris.
    Last edited by HaTaX; 08-20-11 at 02:34 AM.
    08-20-11 02:20 AM
  7. xsacha's Avatar
    I realise those games are made with the Native SDK but I don't have the .bar (zip) files to inspect. I suppose there's a way to pull them off while downloding them. Might check in ssh.

    For the packaging, I'm just thinking of a nicer tool to sign these packages. Maybe a way to automatically create an app.xml, package/sign and then push.
    I'm thinking: drag a file on to publish.bat and it does everything for you.
    Would surely make a lot more people interested by reducing steps significantly.
    08-20-11 02:50 AM
  8. HaTaX's Avatar
    Another app that's worth looking into is Acrobat reader, that app seems to lay down a library (.so) and access it through the SWF.

    Scrapbook is also a native app, it's a good candidate for info. I'm willing to bet that the TAT ui work will eventually be built into the NDK for making apps other then games.
    Here's the bar file for scrapbook (latest build) : Multiupload.com - upload your files to multiple file hosting sites!
    08-20-11 03:45 AM
  9. xsacha's Avatar
    Thanks for scrapbook.

    Ok, well libscreen seems to be a wrapper around Photon that adheres to the Playbook UI. It has functions like screen_create/destroy_window, screen_create/destroy_context
    Quite easy to make prototypes (screen.h) for them.

    Scrapbook has a library 'libcascades' which looks like it is part of this fabled Native SDK. It provides things like Text Field, Cursor and Animation.
    08-20-11 06:34 AM
  10. dkonigs's Avatar
    Source code to a functional proof-of-concept graphical PlayBook native app, buildable using QNX Momentics, or it didn't happen.
    08-20-11 07:53 AM
  11. xsacha's Avatar
    Hang in there dkonigs, I gotta write the headers and get around this package signing (worst in the industry).
    Work just finished.
    08-20-11 07:56 AM
  12. HaTaX's Avatar
    Source code to a functional proof-of-concept graphical PlayBook native app, buildable using QNX Momentics, or it didn't happen.
    This is very doable and he is using the correct tools to do so. When I tinkered with it I stopped at getting a live window up with a few lines of text, so it's not impossible and actually quite probable.

    If he comes up with a nice base for everyone else to work with, then this will be nice progress forward for those who like to tinker. I'm actually quite interested in the Cascades interface that is being used by some of the native apps, this is the interface that TAT wrote originally for the Android platform and is what you heard talked about in the TAT UI videos. Remember the scrolling 3D contact list everyone thought was so cool? Done with their cascades library.

    Go get em xsacha! This will be a nice fill in until the NDK is released. Also gives some developers an early view of what they can do with the NDK, and might even let them get a head start on their applications if they're intending to write their applications with the NDK when it's released.
    08-20-11 12:11 PM
  13. blackjack93117's Avatar
    It warms my heart knowing the techies are collaborating on this stuff whatever the heck they are talking about lol Keep it up guys....get 'er done!
    08-20-11 12:15 PM
  14. HaTaX's Avatar
    Well here's something that could come from this, remember the Quake 3 video that you saw floating about? Between running NFS and some of the other native apps through IDA (reverse engineering software), we might be able to do our own port of it.

    This probably won't be useful for apps that are created from scratch as you would have to do a lot of discovery, but it could be very useful to port over existing apps and have them run with minimal work.

    Here's one that I've got my eye on as a project if the framework xsacha comes up with is workable: rdesktop: A Remote Desktop Protocol client Wouldn't it be nice to have RDP on your PlayBook without needing Android player?

    I'd put some time into it, but right now he's doing quite a bit of legwork to map the needed functions and libraries. That was legwork I wasn't so enthralled with doing and I'm very glad to see someone else in on this.
    08-20-11 01:42 PM
  15. xsacha's Avatar
    Hm well I made a bunch of applications (console, Photon, modified native sdk, libscreen) and they all had the same result. It installs fine, I click on the app and it pops up like it's loading and then quits instantly.

    So then I tried repacking the Android Player *exactly* as it was. Confirmed that all the files are identical (except debug token + author/authorId).
    Same result. Click on app, it pops up and then disappears. Then install the RIM one and it works fine.

    So not sure what's going on here. You need a special signature for native apps?

    Yeah, if I replace signatures in my Android Player with RIMs 'signature' it works fine. That's only thing it could be.
    pbbd002 likes this.
    08-20-11 02:34 PM
  16. kbz1960's Avatar
    Nice job, keep at it unless you're tiring of it.
    08-20-11 03:05 PM
  17. dkonigs's Avatar
    I think we're all tired of it, actually. If RIM would just publicly release the damn native SDK already, even as a very rough beta, we wouldn't even have to keep trying any of this.

    Right now the main thing keeping me from trying again is that my QNX Momentics evaluation license key has expired since the last time I tried doing this stuff.
    08-20-11 03:22 PM
  18. dkonigs's Avatar
    Okay, found the magic link for a perpetual non-commercial license, and I've got it running again. Just wish we had an official solution already, even a half-finished one.
    08-20-11 03:46 PM
  19. anon(4018671)'s Avatar
    Okay, found the magic link for a perpetual non-commercial license, and I've got it running again. Just wish we had an official solution already, even a half-finished one.
    wanna share??

    Obviously that would be nice, but you know the situation. No choice but to hang tight.
    08-20-11 04:39 PM
  20. dkonigs's Avatar
    Okay, I've got the tools up and running, and can compile stuff using the Photon libraries. Now, can either of you please actually post a code sample for getting to the point of actually showing *anything* on the PlayBook screen? (yes, even if I need to run it through Momentics)

    Simply calling PhInit() per the Photon tutorial code samples isn't working.
    08-20-11 04:39 PM
  21. togardergrosse's Avatar
    Darn it guys! Use ENGLISH please! LOL

    sorry, can't understand a bit about programming and such, but keep doing what you do
    08-20-11 05:28 PM
  22. xsacha's Avatar
    Simply calling PhInit() per the Photon tutorial code samples isn't working.
    Well before trying Photon, try to repack an existing native binary like Android Player or Scrapbook.
    If you repack one of those apps with 'identical' code and it doesn't work -- we have other problems.

    Update: Scrapbook working, Android Player not. I think we can't run android_player permissions with debug tokens?
    Last edited by xsacha; 08-20-11 at 09:41 PM.
    08-20-11 09:10 PM
  23. dkonigs's Avatar
    I think Android Player is a special case, as some of us found references to it within the PlayBook OS 1.0.7.2670 update image.

    That being said, can you please just post some basic code sample for successfully initializing the GUI? Two of you now claim to have been able to do it, but I still haven't seen any code.
    08-20-11 10:36 PM
  24. xsacha's Avatar
    Cause can't load GUI from ssh as devuser. Even though it says succeeded, there's no visual.

    And app doesn't seem to launch at all when packaged. Even a console app.

    Any clues?
    08-20-11 11:24 PM
  25. dkonigs's Avatar
    Actually, it doesn't say it succeeded. A plain call to "PtInit(NULL)" fails. I did some tinkering, looking through /dev (where there is no "/dev/photon"), and tried passing "/dev/sapphire" just to see what happened. It actually got a bit further, and failed with an error about being unable to connect to the font server.

    I still have seen no evidence that Photon is actually running/usable on the PlayBook. However, the libraries are there.

    Since neither you nor HaTaX have actually shared any code, I'm still not sure what you've actually been able to do. (Beyond a simple command-line binary, which we've all been able to do for months now.)
    08-20-11 11:33 PM
37 12
LINK TO POST COPIED TO CLIPBOARD