Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>All you can do is register a receiver with the intent filters like <code>android.intent.action.PACKAGE_INSTALL</code> or <code>android.intent.action.PACKAGE_REPLACED</code> from which you can restart your application back again.</p> <pre><code>&lt;receiver android:enabled="true" android:exported="true" android:label="BootService" android:name="com.project.services.BootService"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.BOOT_COMPLETED"/&gt; &lt;data android:scheme="package"/&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.PACKAGE_ADDED"/&gt; &lt;data android:scheme="package"/&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.PACKAGE_INSTALL"/&gt; &lt;data android:scheme="package"/&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.PACKAGE_CHANGED"/&gt; &lt;data android:scheme="package"/&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.PACKAGE_REPLACED"/&gt; &lt;data android:scheme="package"/&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;/application&gt; </code></pre> <p>And </p> <pre><code>public class BootService extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) { Intent serviceIntent = new Intent(); serviceIntent.setClass(context,Controller.class); serviceIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(serviceIntent); } else if (intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)) { Intent serviceIntent = new Intent(); serviceIntent.setClass(context, Controller.class); serviceIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(serviceIntent); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload