Identify if device is Kindle
Asked Answered
P

4

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.

Pili answered 9/2, 2013 at 8:3 Comment(4)
You might be asking the wrong question. What's the problem on the Kindle?Hamburger
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.Pili
@Hamburger you were right - it was the wrong question. 'How to detect device features' would have been better. Thanks.Pili
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?Hamburger
D
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

Deuteranopia answered 9/2, 2013 at 8:8 Comment(1)
Thanks, perfect! Really appreciate it, such a fast and detailed answer.Pili
M
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.

Myongmyopia answered 9/2, 2013 at 8:15 Comment(0)
G
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");
} 
Glycerinate answered 4/8, 2015 at 11:42 Comment(2)
@Kate I think you miss the last part of my code || Build.MODEL.startsWith("KF") ;)Glycerinate
@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.Glycerinate
M
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.

Mathian answered 15/4, 2015 at 23:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.