This function sets an item with the given key and value.
Note: On Android there is a size limit on the string to be stored. See sap.EncryptedStorage#SIMPLE_STRING_MAXIMUM_LENGTH and sap.EncryptedStorage#COMPLEX_STRING_MAXIMUM_LENGTH for more details.
setItem( key, value, successCallback, errorCallback )
Name | Type | Description |
key | String | The key of the item to set.If null or undefined is passed, "null" is used. |
value | String | The value of the item to set.If null or undefined is passed, "null" is used. |
successCallback | sap.EncryptedStorage~successCallback | If successful, the successCallback is invoked with no parameters. |
errorCallback | sap.EncryptedStorage~errorCallback | If there is an error, the errorCallback is invoked with an ErrorInfo object as the parameter. |
var store = new sap.EncryptedStorage("storeName", "storePassword"); var successCallback = function() { alert("Item has been set."); } var errorCallback = function(error) { alert("An error occurred: " + JSON.stringify(error)); } store.setItem("somekey", "somevalue", successCallback, errorCallback);