setItem( key, value, successCallback, errorCallback ) method

This function sets an item with the given key and value.

If no item exists with the given key, then a new item is created. If an item does exist with the the given key, then its value is overwritten with the given 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.

Syntax

setItem( key, value, successCallback, errorCallback )

Parameters

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.

Example

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);

Source

encryptedstorage.js, line 153.