Let me explain this with more details.
As part of my research, I am writing a device administrator kind of thing, similar on lines of active sync provisioning we have in windows mobiles. Where there will be certain policies sent by the administrator. The use case goes as follows.
Device administrator sends the policies to wipe the phone memory on theft of the phone. So that unauthorized user cant access my data on the phone. Similarly I want to have a control on the usage of Android Market App.
1. If the device administrator blocks the usage of market app, the user should not be able to launch the android market.
2. In case the market app is launched and app is being downloaded/installing and during this process of downloading/installing the app, the Device administrator blocks the usage of market app, then it should stop downloading/installation immediately.
what we tried :
1. We tried clearing the data of market app while download is ongoing by using the clearApplicationUserData API in ActivityManager Class
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
boolean res = am.clearApplicationUserData("com.android.vending", new ClearUserDataObserver());
Result : It shows the Download is in progress , but once the download completes . it will not install the package.i have checked that in the file system the apk is not present.so in this case user may be charged for the downloading the app which cant be installed. this will be unfair to the user.so how can i stop the download itself.similarly how do i handle the case of installation in progress of the market app and then try to stop it ?
your inputs to this will very helpful
Rashmi.