Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

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");
} 

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top