Amazon.Util.Storage.KVStore.Put C# (CSharp) Method

Put() public abstract method

Puts the value identifying it by a key
public abstract Put ( string key, string value ) : void
key string identifier
value string value to be stored
return void
        public abstract void Put(string key, string value);

Usage Example

        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.ClientContextConfig"/> class.
        /// </summary>
        /// <param name="appTitle">App title -  The title of your app. For example, My App.</param>
        /// <param name="appVersionName">App version name - The version of your app. For example, V2.0.</param>
        /// <param name="appVersionCode">App version code - The version code for your app. For example, 3.</param>
        /// <param name="appPackageName">App package name - The name of your package. For example, com.example.my_app.</param>
        /// <param name="appId">App identifier - AWS Mobile Analytics App ID corresponding to your App</param>
        public ClientContextConfig(string appTitle, string appVersionName,string appVersionCode, string appPackageName, string appId)
        {
            if(string.IsNullOrEmpty(appTitle))
            {
                throw new ArgumentNullException("appTitle");
            }
            
            if(string.IsNullOrEmpty(appVersionName))
            {
                throw new ArgumentNullException("appVersionName");
            }
            
            if(string.IsNullOrEmpty(appId))
            {
                throw new ArgumentNullException("appId");
            }
            
            if(string.IsNullOrEmpty(appPackageName))
            {
                throw new ArgumentNullException("appPackageName");
            }
            
            if(string.IsNullOrEmpty(appVersionCode))
            {
                throw new ArgumentNullException("appVersionCode");
            }

            this._appTitle = appTitle;
            this._appVersionName = appVersionName;
            this._appVersionCode = appVersionCode;
            this._appPackageName = appPackageName;
            this._appId = appId;
            
            _kvStore = new PlayerPreferenceKVStore();
            _clientId = _kvStore.Get(APP_CLIENT_ID_KEY);
            if (string.IsNullOrEmpty(_clientId))
            {
                _clientId = Guid.NewGuid().ToString();
                _kvStore.Put(APP_CLIENT_ID_KEY, _clientId);
            }
        }