# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# PackageChangeReceiver

`public abstract class PackageChangeReceiver`
`` `extends BroadcastReceiver` ``

java.lang.Object
↳ | android.content.BroadcastReceiver
| ↳ | android.telephony.PackageChangeReceiver

Helper class for monitoring the state of packages: adding, removing, updating, and disappearing and reappearing on the SD card.

## Summary

### Public constructors
`PackageChangeReceiver()`

### Public methods
`void` | `onHandleForceStop(String[] packages, boolean doit)` This method is invoked when receive the Intent.ACTION_QUERY_PACKAGE_RESTART and Intent.ACTION_PACKAGE_RESTARTED
`void` | `onPackageAdded(String packageName)` This method is invoked when receive the Intent.ACTION_PACKAGE_ADDED
`void` | `onPackageAppeared()` This method is invoked when receive the Intent.ACTION_PACKAGE_ADDED
`void` | `onPackageDisappeared()` This method is invoked when receive the Intent.ACTION_PACKAGE_REMOVED
`void` | `onPackageModified(String packageName)` This method is invoked when receive the Intent.ACTION_PACKAGE_CHANGED or Intent.EXTRA_REPLACING as extra field is true
`void` | `onPackageRemoved(String packageName)` This method is invoked when receive the Intent.ACTION_PACKAGE_REMOVED
`void` | `onPackageUpdateFinished(String packageName)` This method is invoked when Intent.EXTRA_REPLACING as extra field is true
`void` | `onReceive(Context context, Intent intent)` This method is called when the BroadcastReceiver is receiving an Intent broadcast.
`void` | `register(Context context, Looper thread, UserHandle user)` To register the intents that needed for monitoring the state of packages.
`void` | `unregister()` To unregister the intents for monitoring the state of packages

### Inherited methods
From class `android.content.BroadcastReceiver`
`final void` | `abortBroadcast()` Sets the flag indicating that this receiver should abort the current broadcast; only works with broadcasts sent through `Context#sendOrderedBroadcast(Intent, String)`.
`final void` | `clearAbortBroadcast()` Clears the flag indicating that this receiver should abort the current broadcast.
`final boolean` | `getAbortBroadcast()` Returns the flag indicating whether or not this receiver should abort the current broadcast.
`final boolean` | `getDebugUnregister()` Return the last value given to `setDebugUnregister(boolean)`.
`final int` | `getResultCode()` Retrieve the current result code, as set by the previous receiver.
`final String` | `getResultData()` Retrieve the current result data, as set by the previous receiver.
`final Bundle` | `getResultExtras(boolean makeMap)` Retrieve the current result extra data, as set by the previous receiver.
`final BroadcastReceiver.PendingResult` | `goAsync()` This can be called by an application in `onReceive(Context, Intent)` to allow it to keep the broadcast active after returning from that function.
`final boolean` | `isInitialStickyBroadcast()` Returns true if the receiver is currently processing the initial value of a sticky broadcast -- that is, the value that was last broadcast and is currently held in the sticky cache, so this is not directly the result of a broadcast right now.
`final boolean` | `isOrderedBroadcast()` Returns true if the receiver is currently processing an ordered broadcast.
`abstract void` | `onReceive(Context context, Intent intent)` This method is called when the BroadcastReceiver is receiving an Intent broadcast.
`IBinder` | `peekService(Context myContext, Intent service)` Provide a binder to an already-bound service.
`final void` | `setDebugUnregister(boolean debug)` Control inclusion of debugging help for mismatched calls to `Context#registerReceiver(BroadcastReceiver, IntentFilter)`.
`final void` | `setOrderedHint(boolean isOrdered)` For internal use, sets the hint about whether this BroadcastReceiver is running in ordered mode.
`final void` | `setResult(int code, String data, Bundle extras)` Change all of the result data returned from this broadcasts; only works with broadcasts sent through `Context#sendOrderedBroadcast(Intent, String)`.
`final void` | `setResultCode(int code)` Change the current result code of this broadcast; only works with broadcasts sent through `Context#sendOrderedBroadcast(Intent, String)`.
`final void` | `setResultData(String data)` Change the current result data of this broadcast; only works with broadcasts sent through `Context#sendOrderedBroadcast(Intent, String)`.
`final void` | `setResultExtras(Bundle extras)` Change the current result extras of this broadcast; only works with broadcasts sent through `Context#sendOrderedBroadcast(Intent, String)`.
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### PackageChangeReceiver

    public PackageChangeReceiver ()

## Public methods

### onHandleForceStop

    public void onHandleForceStop (String[] packages,
                    boolean doit)

This method is invoked when receive the Intent.ACTION_QUERY_PACKAGE_RESTART and Intent.ACTION_PACKAGE_RESTARTED

Parameters
`packages` | `String`: This value may be `null`.
`doit` | `boolean`

### onPackageAdded

    public void onPackageAdded (String packageName)

This method is invoked when receive the Intent.ACTION_PACKAGE_ADDED

Parameters
`packageName` | `String`: This value may be `null`.

### onPackageAppeared

    public void onPackageAppeared ()

This method is invoked when receive the Intent.ACTION_PACKAGE_ADDED

### onPackageDisappeared

    public void onPackageDisappeared ()

This method is invoked when receive the Intent.ACTION_PACKAGE_REMOVED

### onPackageModified

    public void onPackageModified (String packageName)

This method is invoked when receive the Intent.ACTION_PACKAGE_CHANGED or Intent.EXTRA_REPLACING as extra field is true

Parameters
`packageName` | `String`: This value may be `null`.

### onPackageRemoved

    public void onPackageRemoved (String packageName)

This method is invoked when receive the Intent.ACTION_PACKAGE_REMOVED

Parameters
`packageName` | `String`: This value may be `null`.

### onPackageUpdateFinished

    public void onPackageUpdateFinished (String packageName)

This method is invoked when Intent.EXTRA_REPLACING as extra field is true

Parameters
`packageName` | `String`: This value may be `null`.

### onReceive

    public void onReceive (Context context,
                    Intent intent)

This method is called when the BroadcastReceiver is receiving an Intent broadcast. During this time you can use the other methods on BroadcastReceiver to view/modify the current result values. This method is always called within the main thread of its process, unless you explicitly asked for it to be scheduled on a different thread using `Context.registerReceiver(BroadcastReceiver, IntentFilter, String, android.os.Handler)`. When it runs on the main thread you should never perform long-running operations in it (there is a timeout of 10 seconds that the system allows before considering the receiver to be blocked and a candidate to be killed). You cannot launch a popup dialog in your implementation of onReceive().

If this BroadcastReceiver was launched through a <receiver> tag, then the object is no longer alive after returning from this function. This means you should not perform any operations that return a result to you asynchronously. If you need to perform any follow up background work, schedule a `JobService` with `JobScheduler`. If you wish to interact with a service that is already running and previously bound using `bindService()`, you can use `peekService(Context, Intent)`.

The Intent filters used in `Context.registerReceiver(BroadcastReceiver, IntentFilter)` and in application manifests are not guaranteed to be exclusive. They are hints to the operating system about how to find suitable recipients. It is possible for senders to force delivery to specific recipients, bypassing filter resolution. For this reason, `onReceive()` implementations should respond only to known actions, ignoring any unexpected Intents that they may receive.

Parameters
`context` | `Context`: This value may be `null`.
`intent` | `Intent`: This value may be `null`.

### register

    public void register (Context context,
                    Looper thread,
                    UserHandle user)

To register the intents that needed for monitoring the state of packages. Once this method has been called on an instance of `PackageChangeReceiver`, all subsequent calls must have the same `user` argument.

Parameters
`context` | `Context`: This value cannot be `null`.
`thread` | `Looper`: This value may be `null`.
`user` | `UserHandle`: This value may be `null`.

### unregister

    public void unregister ()

To unregister the intents for monitoring the state of packages

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*