O'Reilly logo

Xamarin Studio for Android Programming: A C# Cookbook by Mathieu Nayrolles

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

Application monitoring

This is the second recipe on our way to building The Internship application. Here, we will monitor the applications that are open on our system.

Getting ready

For this recipe, we will continue to work with the TimeReceiver class created in the previous recipe.

How to do it...

We will do the application monitoring using the following steps:

  1. Create the SMS_APP_NAME constant in the TimeReceiver class as follows:
    private const String SMS_APP_NAME = "com.android.mms.ui.ConversationList";
  2. Add a method called smsAppLaunched, taking a Context object as parameter and returning a Boolean value:
    private bool smsAppLaunched(Context context) { //Check the 20 last launched activity ActivityManager activityManager = (ActivityManager) context.GetSystemService ...

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