# STORED variables not kept after app quit

**URL:** <https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065>\
**Category:** Questions about Thunkable X\
**Created:** [January 2, 2021, 6:46am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065 "2021-01-02T06:46:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bert\_Holbert\_Jr](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Bert\_Holbert\_Jr](https://community.thunkable.com/u/Bert_Holbert_Jr)\
**Post date:** [January 2, 2021, 6:46am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/1 "2021-01-02T06:46:22Z")

</div>

Hello,

When I use a STORED variable in my app it works just fine between screens and even CLOSING the app. The problem is when the app QUITS. I lose all my variables. The app storage still shows 2mb in data. I’m wondering if the initialize variable is clearing the data after a cold app start.

 ![Screenshot_20210102_014458](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/a/ea7a9774ebb9f1f6c0efa32bd94dce398b312007.jpeg)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [January 2, 2021, 7:08am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/2 "2021-01-02T07:08:13Z")

</div>

Stored variables are saved under the app cache/app data so you will lose the data if you uninstall/reinstall or when you clear the app catche/data or when you change App ID in the project screen

---

<div class="post-metadata">

**Author:** ![Bert\_Holbert\_Jr](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Bert\_Holbert\_Jr](https://community.thunkable.com/u/Bert_Holbert_Jr)\
**Post date:** [January 2, 2021, 7:39am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/3 "2021-01-02T07:39:43Z")

</div>

I understand that process. The problem is when the device reboots, or when the app is FORCE closed. At no time is the app data cleared. If I simply go back to the device home screen and back to my app again is the app variables retained.

---

<div class="post-metadata">

**Author:** ![roumak-coder](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@roumak-coder](https://community.thunkable.com/u/roumak-coder)\
**Post date:** [January 3, 2021, 5:46am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/4 "2021-01-03T05:46:36Z")

</div>

This is not the way to use stored variables- ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/4/c41c4ef1db8ee3d36f843f1ae3888e76728848fe.png)  
  
  
You need to use this block - ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/f/5ff97c528043ae2070e1b453f9416105a9ef6db3.png)

---

<div class="post-metadata">

**Author:** ![Bert\_Holbert\_Jr](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Bert\_Holbert\_Jr](https://community.thunkable.com/u/Bert_Holbert_Jr)\
**Post date:** [January 3, 2021, 5:50am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/5 "2021-01-03T05:50:45Z")

</div>

What’s the difference between the two

---

<div class="post-metadata">

**Author:** ![roumak-coder](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@roumak-coder](https://community.thunkable.com/u/roumak-coder)\
**Post date:** [January 3, 2021, 6:01am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/6 "2021-01-03T06:01:52Z")

</div>

The one which you are using that initializes a new stored variable with the value stored in the first variable. And if you use the second one it just changes the value of the variable (it doesn’t initializes it again)  
Hope this helps

---

<div class="post-metadata">

**Author:** ![Bert\_Holbert\_Jr](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Bert\_Holbert\_Jr](https://community.thunkable.com/u/Bert_Holbert_Jr)\
**Post date:** [January 3, 2021, 8:12am UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/7 "2021-01-03T08:12:28Z")

</div>

Bingo! Thanks it works. Thank you very much

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:31pm UTC](https://community.thunkable.com/t/stored-variables-not-kept-after-app-quit/1042065/8 "2024-11-08T13:31:07Z")

</div>


