Skip to main content
Samsung Developer Program

Initializing the Rich Notification Package

Android™ apps must initialize the Srn package to use Rich Notification functionality. 

Srn
srn Creates an Srn instance.

initialize()

Verifies that the Android device supports the Srn package.

Verifies that the Srnpackage libraries are installed on the Android device.

When both are confirmed, the method initializes the RN SDK and creates an instance of the Srn package.

Upon failure to initialize, throws an SsdkUnsupportedException exception.

getVersionCode()

Returns the RichNotification SDK version package number as an integer.

getVersionName()

Returns the RichNotification SDK package version name as a string.

SsdkUnsupportedException
SsdkUnsupportedException

Creates an SsdkUnsupportedException class with the specified detail message and error type.

message

errorType

Brief explanation of the error.

Type of error:

 
 

DEVICE_NOT_SUPPORTED

LIBRARY_NOT_INSTALLED

LIBRARY_UPDATE_IS_RECOMMENDED

LIBRARY_UPDATE_IS_REQUIRED          

VENDOR_NOT_SUPPORTED    

Device does not support the Srn package. 

RN SDK library was not installed. 

RN SDK update may be needed.

RN SDK must be installed.

The vendor is not Samsung.

getType()

Returns the cause of RN SDK initialization failure:

DEVICE_NOT_SUPPORTED

LIBRARY_NOT_INSTALLED 

LIBRARY_UPDATE_IS_RECOMMENDED    

LIBRARY_UPDATE_IS_REQUIRED     

VENDOR_NOT_SUPPORTED    

Device does not support the Srn package. 

RN SDK library was not installed.

RN SDK update may be needed.

RN SDK must be installed.

The vendor is not Samsung.

To create an Srn package instance and get RN SDK version info:

Srn srn = new Srn();
try {
    // Initialize an instance of Srn.
    srn.initialize(this);
} catch (SsdkUnsupportedException e) {
    // Error handling
}

To initialize the Srn package and get the version code and name:

Srn srn = new Srn();
try {
    // Initializes an instance of Srn.
    srn.initialize(this);
} catch (SsdkUnsupportedException e) {
    switch (e.getType()) {
       case SsdkUnsupportedException.DEVICE_NOT_SUPPORTED:
         // Indicates that device version is lower than Kitkat
       break;
    }
}

int versionCode = srn.getVersionCode();

String versionName = srn.getVersionName(); 

 

     

    • Was this article helpful?