android服务的monodroid

android服务的monodroid,android,mono,xamarin.android,Android,Mono,Xamarin.android,我想使用monodroid开发一个android应用程序,它作为后台服务运行 任何人都可以提供一个指向如何执行此操作的示例代码的指针吗 谢谢 在我的一本书中,我有一个基本服务的例子。基本思想是定义一个扩展Service的类,并使用Service属性对其进行修饰,以便在AndroidManifest.xml中生成适当的配置(您可以选择自己进行配置,但很少需要这样做) 覆盖-公共覆盖StartCommandResult OnStartCommand(意图、StartCommandFlags标志、in

我想使用monodroid开发一个android应用程序,它作为后台服务运行

任何人都可以提供一个指向如何执行此操作的示例代码的指针吗


谢谢

在我的一本书中,我有一个基本服务的例子。基本思想是定义一个扩展
Service
的类,并使用Service属性对其进行修饰,以便在AndroidManifest.xml中生成适当的配置(您可以选择自己进行配置,但很少需要这样做)


覆盖-公共覆盖StartCommandResult OnStartCommand(意图、StartCommandFlags标志、int-startId)在哪里?此外,根据您的需要,还有其他一些配置服务的步骤。请看,这是绝对重要的。对于决定在单独流程中运行其服务的任何人,您应该在
[Service]
public class MusicService : Service
{
    public override IBinder OnBind(Intent intent)
    {
        return null;
    }

    public override void OnCreate()
    {
        base.OnCreate();

        // ...
    }

    public override void OnStart(Intent intent, int startId)
    {
        base.OnStart(intent, startId);

        // ...
    }

    public override void OnDestroy()
    {
        base.OnDestroy();

        // ...
    }
}