If you look at the Android Documentation for the Intent
ACTION_PACKAGE_REMOVED
, you will see that this broadcast action will be received by any other interested application (other apps who are registered to receive this broadcast), other than your own application.
Quote from the developer.android.com site:
Broadcast Action: An existing application package has been removed
from the device. The data contains the name of the package. The
package that is being installed does not receive this Intent.
Unfortunetaly, because your app can never detect that it is being removed, you cannot trigger a specific function that will change the Wallpaper on the device. If it were possible (which it isn't), a simple function (code follows) would have shown the Select Wallpaper chooser to the user.
Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(Intent.createChooser(intent, "Select Wallpaper"));
It is something the user will have to manually change once he / she has uninstalled your application.
That being said, as far as deleting all your app created files are concerned, let Android handle that for you. Use one of these options depending on the API:
API greater 8 or greater: getExternalCacheDir
API 7 or lesser: getExternalStorageDirectory
.
Something like this will let you determine which one to use depending on the device API:
int currentAPIVersion = android.os.Build.VERSION.SDK_INT;
if (currentAPIVersion >= android.os.Build.VERSION_CODES.ECLAIR) {
// USE getExternalStorageDirectory
} else {
// USE getExternalCacheDir
}