Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
New Contributor
zgabi
Posts: 2
Registered: ‎02-25-2013
My Device: Playbook

Detect device type or physical keyboard

Hello,

 

In my project I'd like to show diffrent layout in Q10 phone (which has physical keyboard)

 

I have 2 questions:

How to detect whether device has physical keyboard?

How to detect the device type in Android project?

 

android.os.Build.MODEL and DEVICE returns Unknown.

Is it possible to use net.rim.device.api.system.DeviceInfo in android project?

 

Thanks.

Trusted Contributor
imre_m
Posts: 160
Registered: ‎11-17-2010
My Device: PlayBook, Z10, Q10

Re: Detect device type or physical keyboard

Hi,

 

1.

To detect the keyboard type on Android, normally you would use getResources().getConfiguration().keyboard

 

The value shows the kind of keyboard attached to the device. One of: KEYBOARD_NOKEYS, KEYBOARD_QWERTY, KEYBOARD_12KEY.

However I never tested this on BB10 as I don't have a Dev Alpha C.

On the Dev Alpha and on simulator it returns the correct value of KEYBOARD_NOKEYS.

 

2.

If your Android app is running on a BlackBerry device, System.getProperty("os.name") returns "qnx".

I wasn't able to find any property which would return the exact device model.

 

BR,

Imre

--
If you find this post useful please Like it.
If it solves your problem please mark as solution.
New Contributor
zgabi
Posts: 2
Registered: ‎02-25-2013
My Device: Playbook

Re: Detect device type or physical keyboard

Hi,

 

Thank you for your answer.

 

I'm using Dev Alpha C simulator (BB10_1_X.338) and getResources().getConfiguration().keyboard returns 1, which is KEYBOARD_NOKEYS. Is it correct? Why? Dev Alpha C has a keyboard.

Can I rely on this config settings or is it always KEYBOARD_NOKEYS?

I don't have device, too.

 

Br,

Gábor

Trusted Contributor
imre_m
Posts: 160
Registered: ‎11-17-2010
My Device: PlayBook, Z10, Q10

Re: Detect device type or physical keyboard

KEYBOARD_NOKEYS certainly would not be correct on Q10 or Dev Alpha C :smileysad:

On the simulator it might be correct...

Did anyone with a Dev Alpha C device test this?

 

It would be nice if someone from BlackBerry could confirm whether getResources().getConfiguration().keyboard is implemented properly in the Android Runtime.

 

I am not able to find any information regarding this in the unsupported APIs documentation: http://developer.blackberry.com/android/apisupport/unsupportedapi_blackberry10_overview.html

 

Imre

--
If you find this post useful please Like it.
If it solves your problem please mark as solution.
Trusted Contributor
basitj
Posts: 107
Registered: ‎04-08-2011
My Device: BlackBerry Q10

Re: Detect device type or physical keyboard

Well guys, on Android 

android.os.Build.MODEL

 

is returning string "Z10" on my Dev Alpha B.

I'm assuming it'll return "Z10" on real Z10 as well. 

 

Tried it on Dev Alpha C and it's returning "Dev Alpha" 

 

Can somebody confirm what exactly will it return on diferent devices?

 

Get Speedometer on your phone. http://www.speedometer.mobi
Retired
jjasmann
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B

Re: Detect device type or physical keyboard

If all you want to do is show a different layout for the Q10, you should let the asset selector do it for you.

 

You can follow this: http://devblog.blackberry.com/2013/03/blackberry-q10-android-apps/

 

    Justin

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com