How to save data in shared preference

How to save data in shared preference

Hi Narendra,

Before you get any help with your questions you need to give us a lot more context in what is your problem. You can check this post that describes the best way of asking help on Outsystems community.

Regards,

Marcelo

Android provides many ways of storing data of an application. One of this way is called Shared Preferences. Shared Preferences allow you to save and retrieve data in the form of key, value pair.

Narendra Kothamire wrote:

How to save data in shared preference

Hi Narendra,

You can use Local-Entity as an alternative for Shared-Preferences.

Create a Table Structure to store Key-Value & get data accordingly wherever require in mobile app.

Hint: Create a Common Client Action that Read Data from Table & Pass Output Variable for each Key added there, So that you can easily get the required key-Value there.


Cheers


Hi Narendra, 

Check out the Cordova plugin : Awesome Shared Preferences.

This plugin uses SharedPreferences on Android and NSUserDefaults on  iOS.

https://www.npmjs.com/package/cordova-plugin-awesome-shared-preferences

OutSystems has a template plugin using which one can build this SharedPreferences plugin once and use it everywhere visually for both iOS & Android.

Check out the link below on how to do this 

https://www.outsystems.com/blog/posts/how-to-create-a-cordova-plugin-from-scratch/

Amalraj P wrote:

Hi Narendra, 

Check out the Cordova plugin : Awesome Shared Preferences.

This plugin uses SharedPreferences on Android and NSUserDefaults on  iOS.

https://www.npmjs.com/package/cordova-plugin-awesome-shared-preferences 

OutSystems has a template plugin using which one can build this SharedPreferences plugin once and use it everywhere visually for both iOS & Android.

Check out the link below on how to do this 

https://www.outsystems.com/blog/posts/how-to-create-a-cordova-plugin-from-scratch/

https://www.npmjs.com/package/cordova-plugin-awesome-shared-preferences 

Link not Working.. 404


Hello Asif, 

I have updated the post with the proper link. 

You can also access the same via the link below 

https://www.npmjs.com/package/cordova-plugin-awesome-shared-preferences


Amalraj P wrote:

Hello Asif, 

I have updated the post with the proper link. 

You can also access the same via the link below 

https://www.npmjs.com/package/cordova-plugin-awesome-shared-preferences


Cheers,

Assif


assif_tiger wrote:

Amalraj P wrote:

Hello Asif, 

I have updated the post with the proper link. 

You can also access the same via the link below 

https://www.npmjs.com/package/cordova-plugin-awesome-shared-preferences


Cheers,

Assif


Check out the SharedPreferences Plugin I uploaded to forge. 

https://www.outsystems.com/forge/component-overview/4995/

Tested on Android. Do let me know if this helps. 


Amalraj P wrote:

assif_tiger wrote:

Amalraj P wrote:

Hello Asif, 

I have updated the post with the proper link. 

You can also access the same via the link below 

https://www.npmjs.com/package/cordova-plugin-awesome-shared-preferences


Cheers,

Assif


Check out the SharedPreferences Plugin I uploaded to forge. 

https://www.outsystems.com/forge/component-overview/4995/

Tested on Android. Do let me know if this helps. 


Hey that's Awesome :)

Sure will check it.


Alternative for Android-iOS Shared or User preferences

Android iOS Shared User Preferences Forge link : 

https://www.outsystems.com/forge/component-overview/5013/




  • Get Actions 
    • GetBoolean       : Retrieves a Boolean value from the preferences
    • GetInteger         : Retrieves a integer value from the preferences
    • GetLongInteger : Retrieves a Long-Integer value from the preferences
    • GetText              : Retrieves a text value from the preferences
  • Put Actions
    • PutBoolean       :  Sets a Boolean value in the preferences
    • PutInteger         :  Sets a integer value in the preferences
    • PutLongInteger :  Sets a  Long-Integer value in the preferences
    • PutText              :  Sets a text value in the preferences
  • ValidateActions
    • HasKey : Check the Specific Key is available or not in the preferences
    • CheckUserPrefrencesPlugin : Check for Cordova Defined & Plugin-Loaded
  • Clear Actions
    • DeleteKey : Removes a value from the preferences of the specified Key
    • ClearAllPreferences : Removes all key-values from the preferences


Cheers



Hi,

What's the difference to the other component? Since it even uses the same Cordova plugin? wouldn't be possible to just improve the existing one?

Regards,

Marcelo