The app has to be started once in order to register the receiver.
<receiver
android:exported="true"
android:enabled="true"
android:name=".VrReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
public class VrReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("VR MANAGER", "The action was given to the BR: " + intent.getAction());
Intent i = new Intent(context, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(i);
}
}