Clear application cache

6 posts, 0 answers
  1. Dimitar
    Dimitar avatar
    50 posts
    Member since:
    May 2014

    Posted 10 Oct Link to this post

    Hi , 

    Is there some implementation for clearing application cache . It seems after log out Firebase still keep the persistance data and on next login it using it. 

    As I read Firebase doesn't offer a way for clear this cached data, so the only way is to clear the application cache . 

     

    Kind Regards

    Dimitar 

     

     

      

  2. nikolay.tsonev
    Admin
    nikolay.tsonev avatar
    316 posts

    Posted 11 Oct Link to this post

    Hello DImitar,

    Thank you for contacting us.

    If I understand you correctly from the provided description, the project you are using the nativescript-plugin-firebase and its login functionality and you are looking for a way to disable the automatical login for the user.

    If this is the case you could review the Listening to auth state changes part of the plugin's README file. where it is described that in the init, you could predefine the callback method of the onAuthStateChanged event, which will give you control over the listener and then immediately re-login the user when the user re-visits your app could be disabled.

    However, if your scenario is different or you are not using the above-mentioned plugin, please provide more info about the problem and for your environment(CLI node, nom tns-core-modules versions). Also, it would be helpful if you could provide some code sample or sample project, which demonstrates the scenario


    Regards,
    nikolay.tsonev
    Progress Telerik
    Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
  3. Dimitar
    Dimitar avatar
    50 posts
    Member since:
    May 2014

    Posted 11 Oct Link to this post

    Hi Nikolay,

    The issue is different. Fairebase in general have this issue . Using an option for offline mode and persistantce is creating a local cache with firebase tables. But when you are logged out from firebase these tables still exist and on next login doesn't meter that used difrent user  these temporary data is visible again. This is a firebase issue. So the only way is to clean application cache . So my question is there some functionality from native script for clear the application cache ?

    Regards,

    Dimitar

     

  4. nikolay.tsonev
    Admin
    nikolay.tsonev avatar
    316 posts

    Posted 11 Oct Link to this post

    Hello Dimitar,

    Thank you for the additional info
    I reviewed your case, however, at this time there is not similar functionality, which allows force clearing the cache in the application from code behind.

    Regarding the topic of the issue, I found that some solution could be to call keepSynced(true) method, which ensures that the data is updated whenever it changes, which drastically improves the chance. More about this workaround could be found in the attached links:
    https://stackoverflow.com/questions/34486417/firebase-offline-capabilities-and-addlistenerforsinglevalueevent
    https://firebase.google.com/docs/database/android/offline-capabilities#section-prioritizing-the-local-cache
    https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/docs/DATABASE.md#keepinsync

    Another option that could be possible workaround is to clear the cache folder of the application as it is described in this threat and to verify whether the problem will be shown again.


    Regards,
    nikolay.tsonev
    Progress Telerik
    Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
  5. Dimitar
    Dimitar avatar
    50 posts
    Member since:
    May 2014

    Posted 13 Oct Link to this post

    Hi Nikolay

    I am using keepSync because I needed the offline mode . KeepSync force firebase to make a local copy  and create this cache which we discussing. So keepsync is not a solution  . Its a bug in firebase , which could be fixed if I clean the general application cache. So if you have an idea how this could be done.   

  6. nikolay.tsonev
    Admin
    nikolay.tsonev avatar
    316 posts

    Posted 16 Oct Link to this post

    Hi Dimitar,

    Did you try following the second suggestion, which I mentioned in my previous comment? Try deleting the content of the cache folder of the application and verify if this will workaround the problem with firebase. An instruction how to access the cache folder with getCacheDir method and to delete the content could be found in this StackOverflow thread. 

    Keep in mind that you should set up CLEAR_APP_CACHE in the AndroidManifest file
    <uses-permission android:name="android.permission.CLEAR_APP_CACHE"/>

    Let me know, whether this helps.

    Regards,
    nikolay.tsonev
    Progress Telerik
    Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
Back to Top