Background Services in Mono for Android: Listing 2
Overriding OnStartCommand()
- By Greg Shackles
- 07/10/2012
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
string command = intent.GetStringExtra(CommandExtraName);
switch (command)
{
case PlayCommand:
startPlaying();
break;
case StopCommand:
stopPlaying();
break;
default:
return base.OnStartCommand(intent, flags, startId);
}
return StartCommandResult.Sticky;
}