Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
This is a very bad idea, if you want to draw the user's attention to the application, then use notifications, but if you still need to move the application to the foreground, then add to the manifest:
<intent-filter>
<action android:name="intent.bring.to.front" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Intent intent = new Intent("intent.bring.to.front");
intent.setComponent(new ComponentName(context.getPackageName(), MainActivity.class.getName()));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.getApplicationContext().startActivity(intent);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question