Using Local Storage Variables and Application Key in Aptify Mobile for Members
To save the local variables throughout your application, AMM uses Local Storage. Examples used in AMM are displayed below. These variables are editable and can be configured to meet your organization's requirements.
Local Storage Declaration:
Â
 var Storage = { UserID: "UserID", LinkID: "LinkID", DisplayName: "DisplayName", TokenID: "TokenID", UserName: "UserName", UserPassword: "UserPassword", RememberMe: "RememberMe", FavEvent: "FavEvent", FavSession: "FavSession", ActiveFeed: "ActiveFeed", ResultPerPage: "ResultPerPage", EventsPastYearCount: "EventsPastYearCount" };
Â
Â
Note
 This should be mainly declared in the aptify.mobile.settings.js file
Â
Creating Local Storage Variables
The following is a generic method used to create Local Storage:
Â
 function CreateLocalStorage(key, value) { if (typeof (localStorage) == 'undefined') { alert(ErrorMessages.LocalStorageSupport); } else { try { localStorage[storageAppKey + key] = value; } catch (e) { if (e == QUOTA_EXCEEDED_ERR) { alert(ErrorMessages.LocalStorageQuotaExeed); } } } } The given code is to create the Local Storage by calling the above method. e.g. key= Storage.EventsPastYearCount and value="1" CreateLocalStorage(Storage.EventsPastYearCount, 1);
Â
Â
The generic method given below is used to read the Local Storage:
Â
 function ReadLocalStorage(key) { if (localStorage == undefined) { alert(ErrorMessages.LocalStorageSupport); return false; } else { return $.trim(localStorage[storageAppKey + key]); } }
Â
For example, ReadLocalStorage(Storage.EventsPastYearCount)
The generic method below is used to delete the Local Storage:
Â
function DeleteLocalStorage(key) { delete localStorage[storageAppKey + key]; } The given code is to delete the Local Storage by calling the above method. e.g. DeleteLocalStorage (Storage.EventsPastYearCount)
Â
Â
Application Key
An Application key is mainly used to differentiate between two applications running on the same domain.
Application Key: var storageAppKey = "AMM";
Â
Note
  This should be mainly declared in the aptify.mobile.settings.js file
Â
Â
Copyright © 2014-2017 Aptify - Confidential and Proprietary