Introducing wearable notifications
Wearable devices are very useful for apps as they allow users to read notifications without having to reach for a handheld.
Getting ready
To make use of notifications on a wearable, we need to have the Android Support Library v4 Component or the Xamarin.Android.Support.v4 NuGet installed on our handheld project.
How to do it...
We can make notifications automatically appear on a wearable if we manage our app's notifications using the NotificationCompat
type:
- To display typical notifications on a wearable, we will build and display them using the
NotificationCompat
andNotificationManagerCompat
types:var notification = new NotificationCompat.Builder(this) .SetSmallIcon(Android.Resource.Drawable.StatSysDownload) .SetContentTitle("Wearable Notifications") .SetContentText("This is a notification from a device.") .SetContentIntent(pendingIntent) .Build(); var manager = NotificationManagerCompat.From(this); manager.Notify(NotificationId...