What you need is to use a Broadcast Receiver that listens to this action
RECEIVE_BOOT_COMPLETED
, with that it can be detected when the equipment
finished the restart.
I'll give you this sample code
You declare the following on your AndroidManifest:
Permission
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Broadcast Receiver
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Then you create your BroadCast Receiver
package tu.paquete;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class TuBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//cuando detecta la acción del reinicio completado, inicias tu activity
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
Intent i = new Intent(context, TuActividad.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
I leave an example link if you want: Take action after of the restart