ServiceItem
This is the most important class in the Rainbow SDK, as it holds all the information that is needed for an account. From that class, and that class only, we can create an instance of the Cloud Manager.
We can create an instance of that class by calling the default constructor:
RServiceItem rServiceItem = new RServiceItem();
But, we shouldn’t call this method, unless we have all the variables that are needed to properly use it. Instead, we should get the entries that are stored in the connectedList variable of the corresponding Service instance.
You should never create an instance of the RServiceItem class. This is a generic class, that has code that is used by the super-classes.
This class has two properties:
- name[String]: The name of the account. The Rainbow SDK sets the value of the rAPI.name to that value
- iD[String]: It is a guid and it used to distinguish them. Thus, you can create as many instances of that class with the same name
The ServiceItems for OAuth2 Login have a few more properties:
- oauthAccessToken[String]: The Access Token
- oauthRefreshToken[String]: The Refresh Token
- oauthExpirationDate[Date]: The Expiration Date
The above values are set by the instance of the API class, and except the Access Token, the other two variable may be an empty string.
The MediaFireServiceItem class has the properties: sessionToken, pkey, and time. The RSugarSyncServiceItem class has the properties: sugarSyncAccessTokenLocation, sugarSyncRefreshTokenLocation, and sugarSyncActivationDate. The RIDriveServiceItem class has the properties: userID, password, and baseURL
The ServiceItem class has one method to check and refresh the Access token.
rServiceItem.checkStatus();
That method calls the onStatusChecked(boolean status) method of the ServiceCallback callback to inform you about the status. You shouldn’t have to call that method. The Rainbow SDK is regularly calling it to validate the Access Token (whenever that is needed).
Finally, the ServiceItem class is both Parceable and Serializable