Process Phoenix Documentation

repository·trunk·Indexed 24 days ago

https://github.com/jakewharton/processphoenix

An Android utility library for restarting an application's process. It provides functionality to trigger a process rebirth via triggerRebirth(context) and detect if the current process is a rebirth process using isPhoenixProcess(context), primarily for handling state changes in debug builds.

Tokens
359
Snippets
3
Records
3
Agent score
30%

What's inside Process Phoenix

  1. Restart your application process with ProcessPhoenix

    trunk

    Process Phoenix allows you to restart your application process. This is useful for handling fundamental state changes in debug builds, such as switching between staging and production environments.

    Use triggerRebirth(context) to start the default activity in a new process, or provide a specific Intent if you need to launch a particular component.

    // Start the default activity in a new process
    ProcessPhoenix.triggerRebirth(context);
    
    // Or, launch with a specific Intent
    Intent nextIntent = //...
    ProcessPhoenix.triggerRebirth(context, nextIntent);
  2. Skip initialization in a Phoenix process

    trunk

    When your application restarts via Process Phoenix, you may want to skip certain initialization logic in your Application.onCreate() or Activity.onCreate() to avoid redundant setup. Use isPhoenixProcess(context) to detect if the current process is a rebirth process.

    if (ProcessPhoenix.isPhoenixProcess(this)) {
      return;
    }