S
S
sitev_ru2015-06-12 14:26:55
Android
sitev_ru, 2015-06-12 14:26:55

How to open your application on top of others?

I am running my application written for Android. I collapse or open on top of any other.
How to open your application on top of other applications by event (even if by timer)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
daspisch, 2015-06-12
@daspisch

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>

and in the right place call:
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);

but again, don't do that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question