This is a migrated thread and some comments may be shown as answers.

Clear application cache

5 Answers 600 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dimitar
Top achievements
Rank 1
Dimitar asked on 10 Oct 2017, 09:55 AM

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 

 

 

  

5 Answers, 1 is accepted

Sort by
0
Nikolay Tsonev
Telerik team
answered on 11 Oct 2017, 05:16 AM
Hello ,

Thank you for contacting us.

If I understand you correctly from the provided description, the project you are using the -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 -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.
0
Dimitar
Top achievements
Rank 1
answered on 11 Oct 2017, 09:50 AM

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

 

0
Nikolay Tsonev
Telerik team
answered on 11 Oct 2017, 12:50 PM
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.
0
Dimitar
Top achievements
Rank 1
answered on 13 Oct 2017, 03:11 PM

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.   

0
Nikolay Tsonev
Telerik team
answered on 16 Oct 2017, 07:27 AM
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.
Tags
General Discussion
Asked by
Dimitar
Top achievements
Rank 1
Answers by
Nikolay Tsonev
Telerik team
Dimitar
Top achievements
Rank 1
Share this question
or