aboutsummaryrefslogtreecommitdiff
path: root/experimental
diff options
context:
space:
mode:
authorMark Goldstein <markgoldstein@google.com>2017-11-15 11:50:14 -0800
committerMark Goldstein <markgoldstein@google.com>2017-11-15 11:50:14 -0800
commit16e4bf4bca8de6359613691ac1b4910f818d6e46 (patch)
tree23734662c864419f1fab2f1c20a7931e6815a752 /experimental
parentd07777a7a6b6fcb812a0636772bf980184f35ea0 (diff)
downloadandroid-16e4bf4bca8de6359613691ac1b4910f818d6e46.tar.gz
Docs: A demo of using github code samples with the includecode macro
Test: This is just for staging and demo. No tests needed. Change-Id: Idf4537e9bdad34fb4e0c8aab3a5288778d6e5856
Diffstat (limited to 'experimental')
-rw-r--r--experimental/markgoldstein/snippets1.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/experimental/markgoldstein/snippets1.java b/experimental/markgoldstein/snippets1.java
new file mode 100644
index 00000000..90b2f461
--- /dev/null
+++ b/experimental/markgoldstein/snippets1.java
@@ -0,0 +1,28 @@
+// These are some test snippets
+//
+// [START snip1]
+import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.NotificationManagerCompat;
+import android.support.v4.app.NotificationCompat.WearableExtender;
+// [END snip1]
+
+
+// [START snip2]
+int notificationId = 001;
+The channel ID of the notification.
+String id = "my_channel_01";
+// Build intent for notification content
+Intent viewIntent = new Intent(this, ViewEventActivity.class);
+viewIntent.putExtra(EXTRA_EVENT_ID, eventId);
+PendingIntent viewPendingIntent =
+ PendingIntent.getActivity(this, 0, viewIntent, 0);
+
+ // Notification channel ID is ignored for Android 7.1.1
+ // (API level 25) and lower.
+ NotificationCompat.Builder notificationBuilder =
+ new NotificationCompat.Builder(this, id)
+ .setSmallIcon(R.drawable.ic_event)
+ .setContentTitle(eventTitle)
+ .setContentText(eventLocation)
+ .setContentIntent(viewPendingIntent);
+// [END snip2]