Jaldhar
Jaldhar

Reputation: 279

Detecting Blackberry 10 Android runtime

I ported my android app to bb10 and it works quite well. However there are a couple of features I should turn off because they require the Google Play store. When I had a similar problem with the Amazon Kindle Fire I dealt with it by checking android.os.Build.MODEL and blacklisting Kindle devices. Is the right approach to take on BB10 and if so what are the model strings for current and future devices? Or is their a better way of dealing with this?

Upvotes: 2

Views: 1790

Answers (2)

Jorgesys
Jorgesys

Reputation: 126543

We use this function to detect if our android app is running on Blackberry Device (BB10, Playbook), Kindle Fire or Android device::

/**
     * @return platform id
     * 1 Android
     * 2 Amazon
     * 3 Blackberry
     */
    public static int getPlatform(){
        if(android.os.Build.BRAND.toLowerCase().contains("blackberry")){
            return 3;
        }else if(android.os.Build.MODEL.toLowerCase().contains("kindle")){
            return 2;
        }else{
            return 1;
        }           
    }

Upvotes: 2

user1845712
user1845712

Reputation:

You can use the System.getProperty method to detect if your Android application is running on a BlackBerry PlayBook tablet, or BlackBerry 10 device.

System.getProperty(“os.name”);

On a BlackBerry device, this returns "qnx".

Via: http://supportforums.blackberry.com/t5/Android-Runtime-Development/How-to-Detect-if-an-Android-Application-is-Running-on-a/ta-p/1470313

Upvotes: 8

Related Questions