Wednesday, 15 February 2012

android - How to check for supported S Pen devices? -



android - How to check for supported S Pen devices? -

how can determine if device has s pen?

note using sdrawlibrary.issupportedmodel() on samsung s3 returns true know s3 not have s pen.

any gaudiness or help appreciated.

the method using has been removed s pen sdk. update sdk 2.2.5 version, because there lot of improvements.

at moment library doesn't provide method check whether device has s pen or not. utilize build class obtain info device, prepare list containing models has s pen, check if device on list. not reply expected, because requires maintain list date.

private static final string samsung = "samsung"; private static final string note = "gt-n"; private static final string spen_feature = "com.sec.feature.spen_usp"; private final list<string> mspendevices; public boolean isspensupported() { featureinfo[] infos = getpackagemanager().getsystemavailablefeatures(); (featureinfo info : infos) { if (spen_feature.equalsignorecase(info.name)) { homecoming true; } } if (build.model.touppercase(locale.english).startswith(note)) { homecoming true; } if (samsung.equalsignorecase(build.manufacturer)) { (string model : mspendevices) { if (model.equalsignorecase(build.model)) { homecoming true; } } } homecoming false; }

edit: because of models galaxy note series starts "gt-n" added check code. aware of devices in usa has other naming, in still not best solution.

another possible approach check if device has com.sec.feature.spen_usp feature, far know works starting jb. updated code above.

android

No comments:

Post a Comment