Start operation when rebooting mobile devices

I want to create an application. What will start with a mobile restart. I can start my activity using the intent of "android.intent.action.BOOT_COMPLETED" but "SAMSUNG NOTE" has the ability to restart a mobile device that is not required to shut down, and then turn on here, I encounter a problem that my application does not start when rebooting

+4
source share
1 answer

Problem Solved at the moment by deleting the code that is commented out.

Intent startMainActivity = new Intent(context,MyActivity.class); startMainActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(startMainActivity); /* Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(startMain);*/ 

I used the commented code to launch the home screen after starting my application

+1
source

Source: https://habr.com/ru/post/1480264/


All Articles