com.samsung.android.sdk.accessory

Class SA

  • java.lang.Object
    • com.samsung.android.sdk.accessory.SA
  • All Implemented Interfaces:
    com.samsung.android.sdk.SsdkInterface


    public class SA
    extends java.lang.Object
    implements com.samsung.android.sdk.SsdkInterface
    SA is the entry class that provides access to the Samsung Accessory SDK. This class provides methods for initializing the Samsung Accessory SDK and for checking whether the Accessory feature is supported.

    All Samsung SDKs, including the Samsung Accessory SDK, provide a uniform interface for initialization, checking whether features are enabled, and getting the SDK version info. The application must call initialize(Context) to initialize the Samsung Accessory SDK before using it. To get the version number (int) and name (string) of the Samsung Accessory SDK, call getVersionCode() and getVersionName().

     
    
     
    
     public class HelloAccessory extends SAAgent {
    
          @Override
    
         public void onCreate() {
    
             super.onCreate();
    
     
    
             SA mAccessory = new SA();
    
             try {
    
                 mAccessory.initialize(this);
    
             } catch (SsdkUnsupportedException e) {
    
                 // Error Handling
    
             } catch (Exception e1) {
    
                 // Error Handling
    
             }
    
             
    
             int mVersionCode = mAccessory.getVersionCode();
    
             String mVersionName = mAccessory.getVersionName();
    
         }
    
     }
    
     
    
     
    
     

    Developer Guides

    For more information about using Accessory, please refer to the Accessory Programming Guide.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DEVICE_ACCESSORY
      Accessory feature ID
      static int SERVICE_MESSAGE
      Message Service feature ID.
    • Constructor Summary

      Constructors 
      Constructor and Description
      SA()
      Creates an SA instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getVersionCode()
      Returns the version number of the Samsung Accessory SDK.
      java.lang.String getVersionName()
      Returns the version name of the Samsung Accessory SDK.
      void initialize(android.content.Context context)
      Initializes an instance of the Samsung Accessory SDK.
      boolean isFeatureEnabled(int type)
      Returns true if the Accessory feature on the device is enabled.
    • Field Detail

      • DEVICE_ACCESSORY

        public static final int DEVICE_ACCESSORY
        Accessory feature ID
        Since:
        2.0.19
        See Also:
        Constant Field Values
      • SERVICE_MESSAGE

        public static final int SERVICE_MESSAGE
        Message Service feature ID. It supports to send a message without establishing a service connection between provider and consumer application. If this feature is not available on the device, Samsung Accessory Service Framework should be updated to the lastest vesrion.
        Since:
        2.5.0
        See Also:
        Constant Field Values
    • Constructor Detail

      • SA

        public SA()
        Creates an SA instance.
        Since:
        2.0.19
    • Method Detail

      • getVersionCode

        public int getVersionCode()
        Returns the version number of the Samsung Accessory SDK.
        Returns:
        The Samsung Accessory SDK version number.
        Since:
        2.0.19
      • getVersionName

        public java.lang.String getVersionName()
        Returns the version name of the Samsung Accessory SDK.
        Returns:
        The Samsung Accessory SDK version name.
        Since:
        2.0.19
      • initialize

        public void initialize(android.content.Context context)
                        throws SsdkUnsupportedException
        Initializes an instance of the Samsung Accessory SDK.
        Parameters:
        context - The Context for your application.
        Throws:
        SsdkUnsupportedException - Thrown if the device was not made by Samsung, doesn't support the feature, or the SDK version is not matched.
        java.lang.IllegalArgumentException - Thrown if the Context passed is null or invalid.
        Since:
        2.0.19
      • isFeatureEnabled

        public boolean isFeatureEnabled(int type)
        Returns true if the Accessory feature on the device is enabled.
        Parameters:
        type - The feature ID(must be (DEVICE_ACCESSORY, SERVICE_MESSAGE)).
        Returns:
        true if the Accessory feature is available on the device, else false
        Throws:
        java.lang.IllegalArgumentException - Thrown if the feature ID passed is not valid.
        Since:
        2.0.19