How to Restart Android App Programmatically (ProcessPhoenix)

Sep 28, 2018
Restart the current android app (not just Activity, but the whole Application)

Use ProcessPhoenix library.

ProcessPhoenix.triggerRebirth(context);

Ensure AndroidManifest.xml has the entry <category android:name="android.intent.category.DEFAULT" />, else you might bump into the following exception

java.lang.IllegalStateException: Unable to determine default activity for com.luasoftware.luapass. Does an activity specify the DEFAULT category in its intent filter? at com.jakewharton.processphoenix.ProcessPhoenix.getRestartIntent(ProcessPhoenix.java:89)

<manifest ...>
    <application ...>
        <activity
            android:name=".view.LoginActivity"
            android:theme="@style/AppTheme.NoActionBar"
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

                <!-- for Pheonix -->
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
</manifest>

References:

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.