The Internet to find some code, such as the following, but no response,
Intent Intent=new Intent (getApplicationContext (), MainActivity. Class);
Intent. SetFlags (intent. FLAG_ACTIVITY_REORDER_TO_FRONT);
StartActivity (intent);
CodePudding user response:
Intent. SetFlags (intent. FLAG_ACTIVITY_NEW_TASK); This FLAGCodePudding user response:
App is not in the foreground, the first in the normal way to open, after a period of time (one or two seconds) if not open, and then try to use ActivityManager. MoveTaskToFront to open, if still can't open only to remind users,Now the new version has a permission, whether to allow the background to open the application, as shown in the official document, each big manufacturer is different also, generally only the white list is the default state, their applications to open it is very normal,
CodePudding user response:
Ah, 1/f, positive solutions to add intent. The intent FLAG_ACTIVITY_NEW_TASK flag can be directly through the context. StartActivity (intext) jump