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™ Development

Reply
Highlighted
New Member
Posts: 1
Registered: ‎02-05-2013
My Device: Playbook 10
My Carrier: Orange

java Code in android to check if app is running on blackberry or any other non-android device?

Hi there,

 

I have developed an android app using gingerbread.

I want to repackage and deploy it on blackberry. I did so and my app has some issues in blackberry.

So I want to remove some of the functionalities from my code if it is blackberry.

 

I can modify my code and recreate .apk and .bar respectively

 

 

I want some code  like:

 

if(APP_IS_RUNNING_ON_BLACKBERRY)

{

// do this

}else{

//do that

}

 

How do I know if APP_IS_RUNNING_ON_BLACKBERRY??

Is there any way using android sdk to know if app is not running on android device but on blackberry?

 

Thanks in advance.

 

Contributor
Posts: 20
Registered: ‎02-02-2013
My Device: None - developer using simulator
My Carrier: O2

Re: java Code in android to check if app is running on blackberry or any other non-android device?

You can use the "os.name" system property which will return 'qnx' if the app is running on BlackBerry :

 

Boolean APP_IS_RUNNING_ON_BLACKBERRY;

APP_IS_RUNNING_ON_BLACKBERRY = System.getProperty("os.name").equals("qnx");

 

Jonathan