I have an app that has a MainActivity that is able to run on boot by receiving a boot complete broadcast for older versions of Android like Android 12. It uses this reference answer which works: Android App to start automatically on Boot Up
However, it seems (as usual with Google) to change things and now the app (MainActivity) will not automatically run after the device boots. I just keep going in circles trying to find a solution looking at StackOverflow and also the Android documentation.
Anyone have any sample instructions / code that can receive from a boot complete broadcast and successfully run an Activity?
I can confirm that my app receives the Boot Complete broadcast but fails to open the activity
Here is my current BootReceiver code:
public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { Intent myIntent = new Intent(context, MainActivity.class); myIntent.putExtra("boot", true); myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(myIntent); } catch (Exception ex) { Log.i("BOOTRECEIVER", ex.getMessage()); } } } I've tried the above code. I've tried allowing the overlay permissions from the stackoverflow link provided