Clear app cache on update

Thomas Pedersen 41 Reputation points
2022-08-01T13:53:34.967+00:00

Hello

I was interested in enquiring whether or not someone has any pointers to how you can clear an apps cache upon updating the app.

The specific app I've made can sometimes run into some issues whenever I release an update, but all of these issues gets fixed as soon as you go into settings and clear the apps cache, then it runs perfectly fine again, is there any way to manually force this action upon updating the app?

I have not made any attempt on it myself yet, because I am very unsure exactly where to start, I was thinking that it probably has to happen when you start the app, but I also have to ensure it only happens once the app version is changed to a different one, could "Broadcasting" be the way to go with this?

Any pointers will be fantastic.

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2022-08-02T06:01:07.633+00:00

    Hello,​

    Based on your description, do you need to clear cache in android?
    If so, you can create Dependency Service, then execute Android.App.Application.Context.CacheDir.Delete(); to delete app cache.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.