Creating an Android app with C# and Mono – Part 1

I have been so excited to have some time between my contract and actually find out about Mono framework for C#. I really wanted to jump in to make a simple app so I know what it is all about. I worked with Android in the past but had to use Eclipse with Java. I was little clunky with Java since I work with C# a lot more.

First thing for me was to figure out how Mono works.

Mono virtual machine sits on top of Linux kernel and communicate with Dalvik virtual machine and .NET API using some bindings and settings. There are some mappings going on under the hood. For example if you look at the Intent class that is generated it will look like this



Here ACTION_BATTERY_CHANGED is similar to ActionBatteryChanged method in C#.

So in java if you were calling android.intent.action.BATTERY_CHANGED in C# you will call Intent.ActionBatteryChanged.


Android has this concept called Activity, each activity is inherited from Activity class that does certain things on the phone. You usually have a layout related with an activity. Other important piece is the BroadCastReceiver class, that will handle any BroadCast, for example if you are set and alarm, this class can listen for it. I will use it in my example.


Let’s just get going. Our goal is to create a simple Medicine Tracker App.


Here are the requirements :

1. Have a note field where you just type name of medicines you need to take

2. Select a time for the alarm to go off

3. Add a contact number that will get a text message if you miss the medicine on a day (didn’t hit confirm button within 2 hours).

4. Reminder alert to take medicine

5. Big button to say I have taken the medicine

6. Ability to snooze.

7. Ability to Cancel an alarm.


Here is simple prototype screens:



From this prototype, I know that I will need 3 Activities and following abilities

1. Be able to use the datetime control

2. Pass data between screens.

3. Ability to set Alarm.

4. Be able to broadcast and listen for an event.

5. Be able to send a Text message.


This is the first part of the app. Next time I will walk through the code to show how we can get this app going.

Leave a Reply

Your email address will not be published. Required fields are marked *