From fc7c9f5d5cde1cb109e52fbd723d7ed144b2cffa Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 19 Mar 2018 16:25:01 -0700 Subject: [PATCH] Add use of PendingIntent.getForegroundService() In particular, we have an example of a foreground-service PendingIntent triggered by a 15-second delayed alarm following a button click. This is enough time to exercise use cases like swiping the app out of recents before the alarm fires, therefore entering the "starting a fg service when the app is not in a fg state" flows. Bug: 73559697 Test: this is it Change-Id: If57908ab852c7a0bfab7bb1da8eda0a47493fc6b --- .../layout/foreground_service_controller.xml | 6 +++++ samples/ApiDemos/res/values/strings.xml | 1 + .../android/apis/app/ForegroundService.java | 24 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/samples/ApiDemos/res/layout/foreground_service_controller.xml b/samples/ApiDemos/res/layout/foreground_service_controller.xml index f2a62741a..bf15fef07 100644 --- a/samples/ApiDemos/res/layout/foreground_service_controller.xml +++ b/samples/ApiDemos/res/layout/foreground_service_controller.xml @@ -60,6 +60,12 @@ android:text="@string/start_service_foreground_2"> + +