Change content intent of stopwatch notification to launch MainActivity and scroll to stopwatch page

This commit is contained in:
Phillip Hsu
2016-09-16 19:34:06 -07:00
parent ce1c56e979
commit 398a875654
2 changed files with 27 additions and 4 deletions
@@ -86,7 +86,11 @@ public class StopwatchNotificationService extends ChronometerNotificationService
@Override
protected PendingIntent getContentIntent() {
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra(null/*TODO:MainActivity.EXTRA_SHOW_PAGE*/, 2/*TODO:MainActivity.INDEX_STOPWATCH*/);
// http://stackoverflow.com/a/3128418/5055032
// "For some unspecified reason, extras will be delivered only if you've set some action"
// This ONLY applies to PendingIntents...
intent.setAction("foo"/*dummy action*/);
intent.putExtra(MainActivity.EXTRA_SHOW_PAGE, MainActivity.PAGE_STOPWATCH);
return PendingIntent.getActivity(this, 0, intent, 0);
}