Rajesh K
Rajesh K

Reputation: 713

How to find out the AD Junk present in the device?

I am trying to find out the Ad Junk present (Files which are Downloaded by the AD SDK of other apps).

This is what I have been able to find out till now -

I am loading the list of all the files in the devices and them checking them and grouping them like this

if (file.getPath().toLowerCase().endsWith(".temp") )
{
      //Temp Files found                                   
}
else if (file.getName().endsWith(".apk") && file.canWrite()) 
{
     //Apk Files found                   
}

There are many other cleaner which find out the junk files present in the Device. Even I am trying to achieve the same. Can any one help me on how to identify whether the file is an AD Junk file or not?

Upvotes: 8

Views: 2344

Answers (2)

Anisuzzaman Babla
Anisuzzaman Babla

Reputation: 7490

You can Delete Junk File by

File[] files = getBaseContext().getCacheDir().listFiles();
    for (File file : files) {
    file.delete();
}

And Put this permissions in manifest

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Upvotes: 3

vasiljevski
vasiljevski

Reputation: 369

You could check the codebase of some Open Source Cleaner, like: https://github.com/mzlogin/CleanExpert or https://github.com/DroidsOnRoids/android-device-cleaner and see how they do it.

Upvotes: 2

Related Questions