O'Reilly logo

Xamarin Mobile Development for Android Cookbook by Matthew Leibowitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The notification builder

Some tasks take a long time, or events may occur when the user is not using our app. Because some tasks take a long time, we run them in the background. As a result, we need to let the user know when a task is complete, or that some extra information is needed.

Getting ready

If we are going to support Android versions prior to 3.0, we will have to install the Xamarin Support Library v4 NuGet or component into our project.

How to do it...

If an event occurs when the user is not using our app, we can let the user know about it by using a Notification instance from the following steps:

  1. Create the notification using the NotificationCompat.Builder instance:
    var builder = new NotificationCompat.Builder(this) .SetSmallIcon(Android.Resource.Drawable.StatNotifySync) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required