0

is it possible to run a broadcast receiver to detect, pause installing and alert when an application is installing.

onRecive

public class Receiver extends BroadcastReciver{
public void onReceive(Context context, Intent intent ){

    if(intent.getAction().equals("android.intent.action.PACKAGE_INSTALL")){

    //i want to pause the installing activity and prompt an alert box
}
    }
}

Purpose would be, when an application is going to install, it ask are you really want to install this application.

After doing a lot of R & D I'm really stuck with a solution for this, if u please can help me out with this, thank you a lot.

This is possible according to this research paper. Look page 2 Figure 1.

Akshay
  • 2,506
  • 4
  • 34
  • 55
Romi
  • 119
  • 2
  • 10
  • http://stackoverflow.com/questions/10653787/how-to-block-installation-of-other-application-using-device-administrator-app-in – MysticMagicϡ Nov 19 '12 at 09:03
  • yes but still id does not talk about how to capture the attempt to install a new application and how to pause it! – Romi Nov 19 '12 at 09:10
  • Yes, and I also wanted the same thing as you want to do, but what all I could find was, "Not possible :(" – MysticMagicϡ Nov 19 '12 at 09:13

1 Answers1

0

You cannot pause it. There is no API for this. This is a system level function not meant to be handled by 3rd party applications.

This is a security measure. Image if every app could control the installation of all other apps! It would be a big security misstep! Hence it's not available.

You can, however detect the installation of a package. See this thread:

Receiving package install and uninstall events

Community
  • 1
  • 1
Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
  • I/ActivityManager(243): Starting: Intent { act=android.intent.action.VIEW dat=file:///mnt/sdcard/download/DoneDone.apk typ=application/vnd.android.package-archive flg=0x10000001 cmp=com.android.packageinstaller/.PackageInstallerActivity } from pid 5371 "can i at least capture this event which i got from the logcat??? it happens when i try to install an application" – Romi Nov 19 '12 at 09:50
  • yes its as in my question... but even though u can detect application added, it is not detected application install. that is a problem i face too...... – Romi Nov 19 '12 at 10:05
  • you cannot capture the "attempt to install by a user". You can only capture that an install has been completed. Clear? – Anup Cowkur Nov 19 '12 at 10:11