How to know that the device is galaxy note (or any other specific handset model)

StackOverflow https://stackoverflow.com/questions/10623392

  •  09-06-2021
  •  | 
  •  

سؤال

I am creating an app that uses SPen sdk . the sdk is only Galaxy Note compatible . I want to know at runtime if the phone my app is running on is Galaxy Note , if so I want to make use of SPen SDK classes , else i want to use Simple Canvas . Is there any way of making sure that the phone is Galaxy Note .

Thank You

هل كانت مفيدة؟

المحلول

The S Pen SDK has a method:

SDrawLibrary.isSupportedModel()

It should return true if it's a supported device.

نصائح أخرى

You probably should avoid checking to see specifically if the device is a Galaxy Note. Odds are there are other Samsung devices on the way with pen support that your app could probably support just fine.

Probably better would be to check to see 1) if the device has a stylus, and 2) is made by Samsung. Only if both of these are true would you then use Samsung's SDK calls.

Dianne Hackborn of Google discusses how to check for 1) in this thread:

https://groups.google.com/d/msg/android-developers/2Lckyn8-B8M/EGo00XPhXewJ

As for how to determine if the device is made by Samsung, you can check the BUILD value like this:

/**
 * Returns TRUE if the current device is built by Samsung.
 * 
 * @return
 */
public static boolean isSamsung() {
    return ( "samsung".equalsIgnoreCase(Build.MANUFACTURER)  );
}

Other people would advise that you should stay away from Samsung's SDK entirely, and develop your app using the pen event support already in ICS. This would open your app to supporting active stylus devices from other manufacturers such as HTC, ASUS and Lenovo.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top