Posts Tagged ‘playbook’

cathyj

Creating a DropDown List for PlayBook Applications

Monday, August 29th, 2011

By Cathy Jin – Consultant

If you’re using Flex 4.5.1 to develop a PlayBook application, you will notice that there is no DropDown list control in the Component View. This is due to the fact that DropDown list is not mobile optimized for Flex. I’ve tried to use it but had little success. There are two possible solutions:

1. You can use a Text Input box and a list popup window. You can refer to this link for an example: http://www.adobe.com/devnet/flex/samples/expense-tracker-application.html.

2. An alternative is to use a QNX component, but you will need to rewrite the code if you want the application to run on different operating systems such as iOS or Android. You can find more infromation on using QNX components at the link: http://corlan.org/2011/02/01/working-with-playbook-qnx-list-components/.

Good luck!

oliverm

A Date with SQLite

Thursday, August 11th, 2011

By Oliver Merk – Principal Consultant

Been doing a lot with SQLite lately (sqlite.org) on the PlayBook and elsewhere and wanted to pass on a few quick notes.

First, SQLite columns are typeless.

What?

Yup. Even though you may declare fields as VARCHAR or DATETIME, you may actually store any type of data you want in them. The exception to this rule is for PRIMARY KEY fields declared as INTEGER.

I’ve found that typeless fields can lead to some problems when storing and retrieving date values. I suspect that minor version differences in SQLite are returning different CURRENT_TIMESTAMP values.

Here’s an example of some SQL which creates a table with a date field:

CREATE TABLE location (
    location_ID INTEGER PRIMARY KEY NOT NULL,
    name VARCHAR,
    latitude NUMERIC NOT NULL,
    longitude NUMERIC NOT NULL,
    addDate DATETIME DEFAULT CURRENT_TIMESTAMP);

If I INSERT a new record without specifying the addDate value, SQLite will default to inserting its CURRENT_TIMESTAMP value to populate the addDate field and I get something like 2011-08-11 12:05:10.

But if I decide to explicitly use CURRENT_TIMESTAMP in my insert statement, the value gets stored in an odd-looking decimal format. For example, 2455769.105023148.

Depending on the SQLite version, I may or may not be able to convert the returned date field using JavaScript’s date parsing functions for fields inserted with CURRENT_TIMESTAMP:

Client SQLite version Format Supports JS Date parsing
Chrome (Win) 13.0 beta 3.7.6.3 NO
Firefox (Win) 5.0 3.7.5 NO
PlayBook AIR Runtime 3.7.3 YES

My concern is that the code which now works with the PlayBook might break when it gets its next SQLite update. Guess I’ll burn that bridge when I get to it.

I should also mention a great Firefox add-on called SQLite Manager that allows you to manage these databases.

Oh, and how did I get the SQLite version?

SELECT DISTINCT sqlite_version() AS version FROM sqlite_master;

I’ll leave the rest up to you…

oliverm

PlayBook SDK and Simulator with AIR 2.7

Tuesday, June 28th, 2011

By Oliver Merk – Principal Consultant

An updated version of the BlackBerry® Tablet OS SDK for Adobe® AIR® and the included BlackBerry® PlayBook® Simulator are now available at: http://us.blackberry.com/developers/tablet/adobe.jsp

A couple of things to be aware of when upgrading.

First, make sure you have upgraded to Flash Builder 4.5.1.

Next, backup and delete the blackberry-tablet-sdk-x.x.x folder from {drive}\{Program Files}\Adobe\Adobe Flash Builder 4.5\sdks

Run the installer that you downloaded from the site above: BlackBerryTabletSDK-Air-Installer-1.1.0-2390-Win-201106171136.exe

Unlike the previous version, the SDK now gets installed under {drive}:\{Program Files}\Research In Motion\blackberry-tablet-sdk-1.1.0.

Also, the simulator is now in this new location as well, so update your VMWare® Player to point to the new VM path.

If you have any projects that you’d like to upgrade, do the following:

  • Leave the app.xml namespace at AIR 2.6 (application xmlns=”http://ns.adobe.com/air/application/2.6″). If you try 2.7 like I did, it won’t compile.
  • Remove any hacks such as the monkey-patch swc, compiler additions and extra PlayBook packaging options that you used to get your apps working with the old Simulator.
  • Ensure that the IP address of the new Simulator is updated in your Run/Debug configuration settings.
  • Clean the project and let it rip…

Please let us know if you run into any problems using the new PlayBook® SDK.

Also check out NTG’s courses for developing apps for the PlayBook using WebWorks and Flex/AIR

Chad Upton

BlackBerry PlayBook Tips and Tricks

Wednesday, June 8th, 2011

By Chad Upton – Senior Consultant

I’ve been using the BlackBerry PlayBook for a number of weeks now and I’d like to share some useful actions, most of which are not well known.

 

PlaybookSwipes

Swipes

  • Show/hide the title bar inside an app – swipe along the path of a red arrow
  • Show/hide the keyboard – swipe along the path of the blue arrow
  • Rotate the simulator between landscape and portrait mode (simulator only) – orange arrow

Power

  • Wake up from standby – swipe from bezel to bezel (side/side or top/bottom)
  • Restart or shutdown – tap the power icon in the status bar to reveal a menu that has shutdown/reset options (OS 1.0.5+) or hold the power button for two seconds or tap the power app
  • Power cycle – hold the power button until it begins rebooting

Keyboard

  • Add an ellipse – hold down the letter M to reveal a new character menu
  • Add the copyright symbol – hold down the letter C to reveal a new character menu
  • Add the trademark symbol – hold down the letter T to reveal a new character menu
  • Add the registered symbol – hold down the letter R to reveal a new character menu
  • Add the paragraph symbol – hold down the letter P to reveal a new character menu

Other

  • Mute - Hold the play/pause button for 2 seconds
  • Screenshot - Press the volume down and volume up buttons at the same time, photos appear in the pictures gallery
  • Caps Lock – Hold the shift button on the keyboard for one second
  • Add a period – Double tap the spacebar when typing (doesn’t work in all apps), same as BlackBerry and Android phones and iPhone/iPad
  • Show calendar – Tap the clock in the status bar
  • Keyboard and mouse – pair it with a bluetooth keyboard and/or mouse (right mouse button used for bezel gestures)
oliverm

jQuery Mobile With WebWorks Gotcha

Monday, June 6th, 2011

By Oliver Merk – Principal Consultant

Since RIM’s WebWorks platform for the PlayBook is based on HTML5, it’s natural to use a popular JavaScript framework such as jQuery Mobile. One thing to be aware of when creating a WebWorks app in this way is that the jQuery Mobile framework relies on AJAX calls to load pages. When your HTML is hosted on a server, this works great. But when running a WebWorks application you’re actually running off the file system, where the URL starts with file:///. If you try to link from your main index.html to another HTML file using jQuery Mobile, the browser throws an error: XMLHttpRequest cannot load file file:///… Origin null is not allowed by Access-Control-Allow-Origin. If you run your HTML in Google Chrome and open the Developer Tools (Ctrl-Shift-i), you’ll see this error in the console. jQuery Mobile pops up a quick error message as well: Error Loading Page.

Basically, the AJAX call is failing because the browser is considering a file request as though it were a request to another domain and prevents it, for your own safety and security.

The remedy for this is to create all of your jQuery Mobile “pages” in one file. That is, having multiple page tag sets in your index.html file:

<div id="faq" data-role="page">...

To “go to” these pages requires that your anchor tags point to the id of the “page” you want:

<a href="#faq">FAQ</a>

Of course, this becomes a bit unweildy for larger applications since all layout now has to be in one file.

I’ve seen this problem reported as a Chrome bug, so it could really be a WebKit problem. Hopefully this will get fixed soon and find its way into the PlayBook’s WebKit-based browser.

Please comment if you’ve run into this or found another solution.

andreiv

Deploying AIR Apps for Android on the BlackBerry PlayBook

Monday, May 30th, 2011

By Andrei Vanahel – Consultant

Recently RIM confirmed that Android apps will eventually run on the BlackBerry PlayBook device (last time I checked it should be at some point this summer). But there are currently some extra steps required in order to get AIR apps for Android running on the PlayBook.

I know that your Android app has a nice descriptive name but let’s call it “MyApp.apk”

1. Unzip the MyApp.apk file with any ZIP tool (if .apk extension is not recognized by the tool rename the file to MyApp.zip)

2. After unzipping you will get a structure similar to this one:

  • assets
  • lib
  • META-INF
  • res
  • AndroidManifest.xml

3. “assets” is the folder where the AIR app is located

The second step is to package the AIR application for PlayBook using the blackberry-airpackager utility from BlackBerry SDK.

4. Navigate to the “assets” folder from the command line window and run the following command:

“C:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\blackberry-tablet-sdk-1.0.1\bin\blackberry-airpackager” –package MyApp.bar META-INF/AIR/application.xml MyApp.swf assets/ data/ images/

NOTE: Change the path to the BlackBerry SDK if it’s different from the default. MyApp.swf assets/ data/ images/ are the resources you want to be included in your PlayBook app.

If you want to package and deploy your app on the PlayBook simulator to test it, first run the following command from the same location:

“C:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\blackberry-tablet-sdk-1.0.1\bin\blackberry-airpackager” –package MyApp.bar -installApp -launchApp META-INF/AIR/application.xml MyApp.swf assets/ data/ images/   -device <yourSimulatorIP> -password <yourSimulatorPassword>

The next step is to sign a .bar application in order to run it on a real PlayBook device using the blackberry-signer utility from Blackberry SDK.

NOTE: I am assuming you already have a) Signing Keys from RIM (if not, order them from here: https://www.blackberry.com/SignedKeys/) and b) P12 certificates.

5. Run these two commands to sign your .bar file:

“C:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\blackberry-tablet-sdk-1.0.1\bin\blackberry-signer” -verbose -cskpass <your CSK password> -keystore <your P12 file> -storepass <your P12 file password> <BAR_file.bar> RDK

“C:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\blackberry-tablet-sdk-1.0.1\bin\blackberry-signer” -keystore <your P12 file> -storepass <your p12 file password><BAR_file.bar> author

Finally, install the signed app directly on the PlayBook device using the blackberry-deploy utility from BlackBerry SDK.

6. Run this command:

“C:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\blackberry-tablet-sdk-1.0.1\bin\blackberry-deploy” -installApp -password <yourPlayBookPassword>  <yourPlayBookIP> MyApp.bar

oliverm

BlackBerry PlayBook Developer Links

Sunday, May 29th, 2011

By Oliver Merk – Principal Consultant

General

Developing Adobe AIR Application for PlayBook

QNX Components for AIR apps

WebWorks (for PlayBook)

HTML5

NTG Training Courses