summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authoranaddaf <anaddaf@google.com>2014-08-15 09:46:44 -0700
committeranaddaf <anaddaf@google.com>2014-08-15 09:46:44 -0700
commitd97ecae3db7b06238e215f6cde15b1bfee658a02 (patch)
tree176a3ba642fb098b52c948c200f14a937c7ad868 /samples
parent340f9ee6445dae5f00edf933728faa17e2ad57d3 (diff)
downloadandroid_development-d97ecae3db7b06238e215f6cde15b1bfee658a02.tar.gz
android_development-d97ecae3db7b06238e215f6cde15b1bfee658a02.tar.bz2
android_development-d97ecae3db7b06238e215f6cde15b1bfee658a02.zip
Upating the "date" content of notifications to include seconds
Including "seconds" in the content of notifications to enables fast creation/update of notifications; previously, the watch-only ones could be created once every minute. Bug: 16898049 Change-Id: Idd7a5b78d4cc948d4c8b3862fd998a91044d6007
Diffstat (limited to 'samples')
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java7
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java2
2 files changed, 5 insertions, 4 deletions
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java b/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java
index 2cac13751..eb0833491 100644
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java
+++ b/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java
@@ -34,8 +34,9 @@ import com.google.android.gms.wearable.PutDataMapRequest;
import com.google.android.gms.wearable.PutDataRequest;
import com.google.android.gms.wearable.Wearable;
-import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Locale;
/**
* A simple activity that presents three buttons that would trigger three different combinations of
@@ -165,8 +166,8 @@ public class PhoneActivity extends Activity implements GoogleApiClient.Connectio
* Returns a string built from the current time
*/
private String now() {
- DateFormat dateFormat = android.text.format.DateFormat.getTimeFormat(this);
- return dateFormat.format(new Date());
+ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
+ return sdf.format(new Date());
}
/**
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java b/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java
index d701ab142..d57148379 100644
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java
+++ b/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java
@@ -107,7 +107,7 @@ public class NotificationUpdateService extends WearableListenerService
if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
// Dismiss the corresponding notification
((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
- .cancel(Constants.BOTH_ID);
+ .cancel(Constants.WATCH_ONLY_ID);
}
}
}