Dan Methad
Dan Methad

Reputation: 217

Android: Changing activity in the background

I want to make 2 pages in my app:

  1. Main page - get push notifications and show data
  2. Chat page - get push notifications for the chat

Is it possible to run 2 activities at the same time (both will have a BroadcastReceiver for the push) and to use FLAG_ACTIVITY_REORDER_TO_FRONT to switch between activities?

Upvotes: 0

Views: 74

Answers (2)

Erez
Erez

Reputation: 2655

I think you should use a Service for all the operations you run in the background.

(A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use.)

Upvotes: 1

stinepike
stinepike

Reputation: 54682

Yes It is possible. You can simply switch between activity and activity can perform action from background also. But it is always better to use service for background works.

Upvotes: 0

Related Questions