12-11-2011 02:12 PM - edited 12-11-2011 02:17 PM
Hello Playbook devs,
I just tried repackaging my Android games for Playbook; I've side-loaded them to the device and I have to say I am impressed - all of them work well out-of-the-box! The only thing I had to do was provide a bigger ( 86x86 ) icon.
There is, however, one glitch. It's debatable if it is a bug but definately it is an incompatibility with Android tablets that's going to cause some pain.
My games are all accelerometer-controlled. They are also all landscape-only ( like most of the games ), so I've got a android:screenOrientation="landscape" in my manifest.
Now, in Android phones and tablets, when one starts this kind of app, the screen rotates 90 degrees clockwise and the ACCELEROMETER ORIENTATION also rotates! Whereas in Playbook, the screen rotates but the accelerometer stays in 'portrait mode' , so to speak. The effect of this: for example in a game where one controls a car by tilting the device ( tilt forward -> speed up, tilt backward -> break, tilt left -> turn left, etc ), here tilting the Playbook forward results in turning right!
Now, it's not so hard to go around this, I would need to detect if the device I am running on is a Playbook and rotate the accelerometer myself, but it's one more hurdle to clear.
- where I can report this
- how do I ( in my android code ) detect that the device I am running on is a Playbook
Solved! Go to Solution.
12-14-2011 10:55 AM
Interesting find. You can report this problem in Issue Tracker: https://www.blackberry.com/jira/secure/Dashboard.j
I'm looking into the second question (identifying the PlayBook).
12-14-2011 11:21 AM - edited 12-14-2011 11:24 AM
Thanks for your reply. Actually the Playbook accelerometer works in exactly the same way as accelerometer in your OS6 and OS7 phones: its X axis always points up the PHYSICAL screen.
Whereas in Android, the X axis always points up the screen as it is currently rotated.
Here's why the Android way is better: imagine I have a landscape-only, accel-controlled game. When I am running on a 9790 ( 480x360, physical screen in landscape ) --> means I dont have to rotate accel axis in my code. When I am running on a 9550 ( 360x480, portrait ) --> my screen gets rotated but my accel does not --> I need to compensate by rotating the axis myself.
To make a decision if I need to rotate axis or not, I need to know if the device I am running on has its PHYSICAL screen in portrait or landscape. And AFAIK (I've asked repeatedly in the forums ) there's NO API in OS 6 or OS 7 to tell me that ( no, getting screenWidth=480 and screenHeight=369 does NOT mean the physical screen is landscape - it can be a 9550 which the user just happens to be holding horizontally at the moment for all I know! )
Bottom line: such app has to have a database of all your phone models with info which one is portrait, and which landscape. Suboptimal, if you ask me. Now you're repeting this mistake in the Playbook.
12-15-2011 09:24 AM
To detect if your Android application is running on a BlackBerry PlayBook you can call System.getProperty(“os.name”) and it should return “qnx”.
On the BlackBerry Smartphone side you can use the Display.getOrientation method to determine the screen orientation. You do not need to build your own database of screen resolutions.
12-17-2011 08:43 AM
Thanks a lot Mark, 'System.getProperty(“os.name”)' works nicely.
'Display.getOrientation' : unfortunately I cannot use this because for some bizarre reason the class 'net.rim.device.api.system.Display' is protected so one needs to obtain signing keys from RIM...
12-19-2011 10:11 AM
You'll really limit yourself if you avoid any signed Classes.
Code Signing keys are free. All you need to do is fill out this form: https://www.blackberry.com/SignedKeys/