mOnAr
mOnAr

Reputation: 17

Start Activity on background

I have an app that responds to Internet message by creating a new Activity and user has 20 seconds to respond.

The problem is when the app is running on background. I can show a notification, but when the user returns to the App the new Activity isn't started.

Is there any way to start an Activity even when the App isn't on foreground (without the activity getting focus) or any easy workaround where the activity would start right after returning to the app? (which would be worse solution, cause I would have to rework the sync timer :)) Thanks

Upvotes: 0

Views: 694

Answers (1)

Cheesebaron
Cheesebaron

Reputation: 24470

Take a look at the Activity life cycle Android Activity Lifecycle

Here you have the onResume() method you can override and do something before the Activity itself is shown. From there you could do some kind of check that you are returning from a notification or a check on that the user has to answer something now and launch a new Activity from the onResume() method.

Upvotes: 1

Related Questions