Running app tasks on installation

If your app needs to start after it is installed or updated, it can register to receive the APP_INSTALL_DONE broadcast in your app's manifest.

<receiver android:name=".AppInstallDoneReceiver" >
    <action android:name="com.clover.intent.action.APP_INSTALL_DONE" />

This provides your app an opportunity to perform any needed first-install or update tasks. Additionally, until an app is explicitly started with an activity start, explicit broadcast, or service start, it is in the "not started" state. This means the app is prevented from receiving any implicit broadcasts for which it registered in its manifest. Receiving the explicit APP_INSTALL_DONE broadcast removes your app from the "not started" state.

Apps are restricted from performing blocking or otherwise long-running operations on a receiver's onHandleIntent() method. This includes, but is not limited to, network requests. If your app needs to do such operations as a result of being installed or updated, start a JobIntentService from the receiver that receives APP_INSTALL_DONE.

public class AppInstallDoneReceiver extends BroadcastReceiver {

  public void onReceive(Context context, Intent intent) {
    AppInstallDoneService.enqueueWork(context, intent);
public class AppInstallDoneService extends JobIntentService {

  static void enqueueWork(Context context, Intent work) {
    enqueueWork(context, AppInstallDoneService.class, 13, work);

  protected void onHandleWork(@NonNull Intent intent) {
        "Hello, app install done for package: " + getPackageName());

Previous versions of the Clover Android SDK described the APP_INSTALL_DONE intent as a service intent. That is, apps would implement a Service to respond to the intent, not a BroadcastReceiver as shown in the example. While the service intent is still supported, it is deprecated; all apps should change to respond to the broadcast. The reason is that Android 26+ introduced restrictions in background execution that prevents services from being started. If your app targets SDK level 26 or higher, the service start method will fail. The Android Developer docs provide detailed information about Background Execution Limits. If you target SDK level 25 or lower, the service intent will work, but you are encouraged to use the broadcast intent to future-proof your apps.

Did this page help you?