android怎么样来检查设备是否支持Sview [英] android how to check if device supports Sview

查看:264
本文介绍了android怎么样来检查设备是否支持Sview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定给定的Andr​​oid设备支持S-观点或不?

How can we determine if given android device supports S-view or not ?

有没有办法通过程序或通过ADB命令?这样我们就可以检查设备是否支持sview,并检查其状态时,将显示它。
任何指导或帮助将不胜AP preciated。

Is there any way programatically or through adb command ? So that we can check if device supports sview and to check its status when it will be shown. Any guidelines or help would be greatly appreciated.

编辑:
我加了下面的解决方法为这个检查。

EDIT : I added workaround below for this check.

此外,如果有人有不同的方法,请让我知道。

Also if someone has different approach please let me know.

推荐答案

我有办法解决这个,
这是三星为它没有固定值在Android的API添加的设备添加额外的功能,所以我们需要手动添加。

I have got workaround for this, These are extra features added by samsung for the devices for which no constant values are added in Android api, so we need to add them manually.

    private static final String SVIEW_FEATURE = "com.sec.feature.cover.sview";
    private static final String HOVER_FEATURE = "com.sec.feature.hovering_ui";
    private static final String SENSOR_HUB_FEATURE = "com.sec.feature.sensorhub";
    private static final String SPEN_FEATURE = "com.sec.feature.spen_usp";

您可以在下面函数调用,

You can call below function as ,

 hasFeature(SPEN_FEATURE );

功能:

private boolean hasFeature(String feature) {
        FeatureInfo[] infos = getPackageManager().getSystemAvailableFeatures();
        for (FeatureInfo info : infos) {
            if (!TextUtils.isEmpty(info.name)) {
                Log.d("TAG", info.name);
                if (feature.equalsIgnoreCase(info.name)) {
                    Log.v("TAG", "Feature supported "+ info.name);
                    return true;
                }
            }
        }
        return false;
    }

这篇关于android怎么样来检查设备是否支持Sview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆