1

I have an Android Wear app that contains an activity with a timer and a view rendered accordingly. When a user swipes right on the activity to get back to the Context Stream a notification appears showing that the App is still counting.

However the user is unable to resume the timer activity from the notification intent because a brand new instance of this activity is launched. I know there is a FLAG_ACTIVITY_REORDER_TO_FRONT flag I can add to the intent but because activity is destroyed when the user swipes right on it, this does not work.

How can I properly resume the activity from the notification. I guess I somehow need to prevent it being destroyed on swiping back?

Thanks in advance!

User24231
  • 506
  • 1
  • 7
  • 20
  • If you want to restart your activity from the corresponding notification, you can add the appropriate information in the pending intent that starts the activity, such as the start time; no need to persist the start time in SharedPreference or so. – Ali Naddaf Dec 23 '15 at 21:24

1 Answers1

1

Once you leave the app, your activities will be destroyed, so you will have to save the time you started the timer somewhere (Shared Preferences is a good option), and then read this in when your app is restarted.

krishan711
  • 873
  • 1
  • 12
  • 27