+

Search Tips   |   Advanced Search

Simple data sharing API concepts

Learn about simple data sharing API concepts.

Share string tokens across applications of the same MobileFirst application family can be accomplished in iOS and Android for both hybrid and native applications. This API is meant for sharing simple strings securely.

The Simple Data Sharing APIs allow any application in the same family to set, get, and clear key-value pairs from a common place. The Simple Data Sharing APIs are similar for every platform, and provide an abstraction layer, hiding the complexities that exist with each native SDK's APIs, making it easy to use.

The following examples show how we can set, get, and delete tokens from the shared credential storage for the different environments.


Hybrid applications

WL.Client.setSharedToken({key: myName, value: myValue})
WL.Client.getSharedToken({key: myName})
WL.Client.clearSharedToken({key: myName})

For more information about the hybrid APIs, see the getSharedToken, setSharedToken, and clearSharedToken functions in the WL.Client class.


iOS native applications

[WLSimpleDataSharing setSharedToken: myName value: myValue];
NSString* token = [WLSimpleDataSharing getSharedToken: myName]];
[WLSimpleDataSharing clearSharedToken: myName];

For more information about the native iOS APIs, see WLSimpleDataSharing Class Reference.


Android native applications

WLSimpleSharedData.setSharedToken(myName, myValue);
String token = WLSimpleSharedData.getSharedToken(myName);
WLSimpleSharedData.clearSharedToken(myName);

For more information about the native Android APIs, see Class WLSimpleDataSharing.


Parent topic: Simple data sharing