1 // These are some test snippets 2 // 3 // [START snip1] 4 import android.support.v4.app.NotificationCompat; 5 import android.support.v4.app.NotificationManagerCompat; 6 import android.support.v4.app.NotificationCompat.WearableExtender; 7 // [END snip1] 8 9 10 // [START snip2] 11 int notificationId = 001; 12 The channel ID of the notification. 13 String id = "my_channel_01"; 14 // Build intent for notification content 15 Intent viewIntent = new Intent(this, ViewEventActivity.class); viewIntent.putExtra(EXTRA_EVENT_ID, eventId)16viewIntent.putExtra(EXTRA_EVENT_ID, eventId); 17 PendingIntent viewPendingIntent = 18 PendingIntent.getActivity(this, 0, viewIntent, 0); 19 20 // Notification channel ID is ignored for Android 7.1.1 21 // (API level 25) and lower. 22 NotificationCompat.Builder notificationBuilder = 23 new NotificationCompat.Builder(this, id) 24 .setSmallIcon(R.drawable.ic_event) 25 .setContentTitle(eventTitle) 26 .setContentText(eventLocation) 27 .setContentIntent(viewPendingIntent); 28 // [END snip2] 29