Install Process Phoenix via Gradle
trunkAdd the Process Phoenix dependency to your build.gradle file to use it in your Android project.
implementation 'com.jakewharton:process-phoenix:3.0.0'repository·trunk·Indexed 24 days ago
https://github.com/jakewharton/processphoenixAn 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.
Add the Process Phoenix dependency to your build.gradle file to use it in your Android project.
implementation 'com.jakewharton:process-phoenix:3.0.0'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);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;
}