Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8709541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:23:10+00:00 2026-06-13T04:23:10+00:00

I have an App that write some file in the SD Card used to

  • 0

I have an App that write some file in the SD Card used to store data object. When the user delete the app or the app is updated, these files remains in the SD and aren’t removed with apk. This could lead to some annoying issue if I change the data management structure of my App, really difficult to fix simply checking if these dat file are already present for various reason.

Is there a way to say to Android OS to remove also these files when the app is unistalled or updated without manual intervention of the user?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:23:11+00:00Added an answer on June 13, 2026 at 4:23 am

    For the update case, yes. Implement a BroadcastReceiver subclass…

    public class MyBroadcastReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(final Context context, final Intent intent) {
            if (intent.getData().equals(Uri.parse("package:<YOUR APP'S PACKAGE>"))) {
                // Clean up for the new app install
            }
        }
    }
    

    … and then add a <receiver> tag to your manifest:

    <receiver android:name =".MyBroadcastReceiver">
        <intent-filter>
           <action android:name="android.intent.action.PACKAGE_REPLACED"/>
           <data android:scheme="package"/> 
        </intent-filter>
    </receiver>
    

    There is also a PACKAGE_REMOVED action, but the Intent with that action fires after apps are removed, so you don’t have a chance to clean up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a database app that we're beginning to write some new systems for
I have a Django app that lets a user upload a file and does
I'm writing a simple web app in PHP that needs to have write access
I'm wanting to write a whiteboard app. I have a beginning that renders a
I have an app that lets the user interact with several forms. I can
I have an Android app that saves a text file directly onto the phone,
Hi I have some code that uses block RandomAccessFile file = new RandomAccessFile(some file,
I have to create an app that will read in some info from a
I have an app that converts binary file into ASCII file. With profiler I
I wondered if it's possible to write some data to CSV file in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.