7

I have an Android app I'd like to offer on the Amazon's AppStore. My app has some location-based features and camera features which I need to disable if the user's device is a Kindle. Is there a way to programmatically detect if a user's Device is a Kindle? I'm aware I can build different versions for Kindle and non-Kindle but I thought I'd first ask if there's a way to detect this in code.

Pierre Rymiortz
  • 1,127
  • 3
  • 15
  • 31
  • 1
    You might be asking the wrong question. What's the problem on the Kindle? – Simon Feb 09 '13 at 08:05
  • The kindle doesn't have a camera, for example. One of the features of my app is to access the camera. I'm exploring if I can e.g delete the camera menu item based on checking if device is a Kindle. – Pierre Rymiortz Feb 09 '13 at 08:08
  • @Simon you were right - it was the wrong question. 'How to detect device features' would have been better. Thanks. – Pierre Rymiortz Feb 09 '13 at 08:13
  • So wrong question :) "How can I disable functionality in my app if the device does not have certain hardware features" Even if you did detect Kindle, what about the 500 other devices without cameras? – Simon Feb 09 '13 at 08:13

4 Answers4

13

To check if the device has a certain feature, you PackageManager.hasSystemFeature(String name) which should be sufficient in your case.

To check for location and camera you can use FEATURE_LOCATION and FEATURE_CAMERA as argument to hasSystemFeature

If you still need to know the hardware of your device, you can check android.os.Build.MANUFACTURER android.os.Build.BRAND android.os.Build.BOARD android.os.Build.DEVICE

iTech
  • 18,192
  • 4
  • 57
  • 80
10

If you want to detect Kindle, check for manufacturer (Amazon) using Build.MANUFACTURER and model using Build.MODEL. The value of model in case of Kindle will vary, it can be KFTT, KFOT, Kindle Fire, etc. See this for model nos.

Abhishek Nandi
  • 4,265
  • 1
  • 30
  • 43
5

You can use this method in identifying a Kindle Device(s)

public static boolean isKindle(){
        final String AMAZON = "Amazon";
        final String KINDLE_FIRE = "Kindle Fire";

        return (Build.MANUFACTURER.equals(AMAZON) && Build.MODEL.equals(KINDLE_FIRE) ) || Build.MODEL.startsWith("KF");
} 
neferpitou
  • 1,642
  • 2
  • 20
  • 26
  • @Kate I think you miss the last part of my code `|| Build.MODEL.startsWith("KF")` ;) – neferpitou Jul 25 '18 at 23:51
  • @Kate I actually have an old Kindle Fire and I can confirm that `Build.Model == "Kindle Fire"` is possible while the `||` part is the fallback of my code. – neferpitou Jul 26 '18 at 00:02
1

I know that this post is old, but the approach to this is wrong. If your concern with Kindles is hardware related i.e. Kindles do not have a camera or camera support then you need to check for camera support not device type. What if other devices do not offer camera support? Instead of suggested answer, try this

public static boolean isCameraAvailable(Context context) {
    PackageManager packageManager=context.getPackageManager();
    if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) {
        // this device has a camera 
        return true; 
    } else { 
        // no camera on this device 
        return false; 
    } 
} 

This is much better than detecting for if device is a kindle, otherwise do another build specific for kindle.

portfoliobuilder
  • 7,556
  • 14
  • 76
  • 136